fixed resource leak with jni array