Use close() instead of shutdown() on the socket when destroying the connection.