Correctly shut down socket.

* Created error for Too Many Pings
* properly terminate the socket from the server side.