Proper handling of closed sockets. (Fixes CPU hogging on socket closed py peer.)