Server Connection Error Catching

Running the same cleanup code on connection errors as on connection ends (weird scenario where 'end' event wasn't fired discovered).

cc @squamos