rewind only works if you only have one line. ftruncate is used to clear the temp file we are using for fgetcsv