Add a write lock to Qdb