removal of listeners before closing results in disconnect state not being set

Hi,

I noticed that the disconnect state was not being propagated after closing the udp connection. I believe it is because the listeners are removed before the socket is closed.  This pull request has my fix, but you might want to double check whether my moving the "removeAllListeners" is the right thing to do.

Cheers,
Gary