Fixed SQLite error on database lock