handle exit signal in handle_lock