Improved SQLite busy handling by using an in-memory lock