Circumvent lack of 'close' event for tls sockets

It appears that in recent versions of node.js, the 'close' event is not
emitted by TLS sockets.  The CleartextStream class specifies that the
'close' event is optional, so such operation is allowed.  In order to
compensate, the event can be trapped at the raw socket layer instead.