Merge "Sanity checks in JNI code for closure creation"