Closing socket before removing IOErrEvt listener