Changed the adding of header to csv logs. Now is written once. It's more efficient, not always check the file type and size.