Release the lock in cases where there is an sqlite3 error.