cleanup curl before possibly returning.