Fix database lock (sqlite)