Only try to release a lock if the db has been opened