Close event before closing socket.
Make new_user_handler() safe from LPC error().