Handled more connection errors. Enabled client to shutdown correctly.