Added finalize method to close the server socket.