added 'close' listener to know when a connection between the client and server has officially closed