I happily assume, that the parameter to `closeHandler` is evaluated lazily. `socket.close()` looks strange to me, programming in JavaScript a lot lately ;)