OnClose lock