[fix] Remove the listeners after closing the socket

Engine.IO uses some listeners to do internal cleanup.
For example a `close` listener is used to handle cases where
the socket is closed while a transport upgrade is being probed.