Fix warnings about clients calling close while holding locks.