Try to shutdown socket instead of ending it