Added socket.close() in main class