fix dangling pointer in destroyWindow JNI bind