Modified to use fgets & str_getcsv instead of fgetcsv, as was terminating before reaching end of file.