PMO-2814 Quit early building CSV file if exceeds line or size limits. (Sometimes the file is 8GB in size!)
(cherry picked from commit 868b1e8)