Export query results to local CSV file