Merge "Switch to a background thread pool"
diff --git a/src/com/android/browser/CrashRecoveryHandler.java b/src/com/android/browser/CrashRecoveryHandler.java
index aa48aac..02636c0 100644
--- a/src/com/android/browser/CrashRecoveryHandler.java
+++ b/src/com/android/browser/CrashRecoveryHandler.java
@@ -34,6 +34,7 @@
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
+import java.io.IOException;
 
 public class CrashRecoveryHandler {
 
@@ -193,15 +194,16 @@
                 RECOVERY_PREFERENCES, Context.MODE_PRIVATE);
         prefs.edit()
             .putLong(KEY_LAST_RECOVERED, System.currentTimeMillis())
-            .commit();
+            .apply();
     }
 
     private Bundle loadCrashState() {
         Bundle state = null;
         Parcel parcel = Parcel.obtain();
+        FileInputStream fin = null;
         try {
             File stateFile = new File(mContext.getCacheDir(), STATE_FILE);
-            FileInputStream fin = new FileInputStream(stateFile);
+            fin = new FileInputStream(stateFile);
             ByteArrayOutputStream dataStream = new ByteArrayOutputStream();
             byte[] buffer = new byte[BUFFER_SIZE];
             int read;
@@ -220,6 +222,11 @@
             state = null;
         } finally {
             parcel.recycle();
+            if (fin != null) {
+                try {
+                    fin.close();
+                } catch (IOException e) { }
+            }
         }
         return state;
     }