Fix bug where errors found while compiling the `end_of_file` term could result in exceptions terms missing the `error/2` wrapper