JNI: Fix failure to unlock for pending exception.
And add a regression test. This was broken by
https://android-review.googlesource.com/1898923
but it was not caught by any direct tests.
Test: Additional test in JniCompilerTest.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 172332525
Bug: 208831945
Change-Id: I41d4999bbf43f8e58c88b87da47be6f7409d9ce1