Allow lock to be used as context manager