Ensure to close sockets