Attempting to fix issue with EOF appearing in file