Fix HTTP client not receiving callback if connection is closed