changed lifecycle manager to account for memory decrease only if deactivate succeeds

git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_tree@1875 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexLifecycleManager.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexLifecycleManager.java
index bec823d..24e6bfd 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexLifecycleManager.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexLifecycleManager.java
@@ -66,8 +66,8 @@
         }
 
         if (info.isOpen) {
-            memoryUsed -= info.index.getInMemorySize();
             info.index.deactivate();
+            memoryUsed -= info.index.getInMemorySize();
         }
     }