Make sure all user's input is sent to the action and then close the socket