Only release write lock if it was grabbed