Simplify curl_multi_exec and prevent hanging