port https memory leak fix from socket.io

https://github.com/Automattic/socket.io/issues/1177 still exists in engine.io

This PR applies https://github.com/Automattic/socket.io/pull/1143 to engine.io