Use 'with' statement for closing sockets.