Fixed how some files end suddenly