Close the connection if we're stopping/dying