onclose() handlers should now be invoked properly and TCP sockets should be closed when a server stops serving