Refactor all database code so that only one instance of SQLiteDatabase is ever created, solving all of the crashes we have been seeing