The write lock is never released here. That seems to be intended behavior, but it's not especially clear from the documentation that the caller becomes responsible for doing so.