Close the socket in shutdown_networking()