Fix a few remaining downgrade locking errors

Fix a few remaining call sites that could generate downgrade lock
errors. Also speed up locking a little by aliasing the __enter__ and
__exit__ methods on the wrapper lock object instead of wrapping them.