Use locks as context managers