go back to using defer to unlock in close and rotate