correctly handle quoting right at the end of the file