Allow lock to be used as context manager

This is useful when the lock is used in this manner in actual code.