Fix namespace iterator in disconnect

Since `socket.onclose` is going to remove things from `this.sockets` while iterating, let's make the iteration tolerant of these modifications.

Addresses https://github.com/Automattic/socket.io/issues/1539.