Close socket when pressing ctrl C