Added missing curl_close() calls