do curl_close() before exception