Make the SQLiteDB<> class threadsafe.