Close cURL handle before recursing, so that cookie file is flushed