Correctly free resouces bound to scripts when the scripts are deleted.

Change-Id: Idfcc30f1a7de0badeb6d8254ed508938d89f4070
b: 3381615
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 40cb5c7..1dfedb3 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -528,6 +528,7 @@
 
 void Context::destroyWorkerThreadResources() {
     //LOGV("destroyWorkerThreadResources 1");
+    ObjectBase::zeroAllUserRef(this);
     if (mIsGraphicsContext) {
          mRaster.clear();
          mFragment.clear();
@@ -542,7 +543,6 @@
          mStateFont.deinit(this);
          mShaderCache.cleanupAll();
     }
-    ObjectBase::zeroAllUserRef(this);
     //LOGV("destroyWorkerThreadResources 2");
     mExit = true;
 }