Properly clean up JNI global refs so the table doesn't fill and crash an app