properly react to close request from the client (client browsers don't close streams, instead they simply send a close request to the server which needs to react by closing the stream