call detach method on thread exit

When call JniHelper::cacheEnv from native thread (not main thread), thread must call JavaVM:: DetachCurrentThread before exit.

http://developer.android.com/training/articles/perf-jni.html#threads