It’s been a while since this happened to me the last time. You can try to compare the AWT in an editor with a working file. For me these errors occured because some of the tags near the end of the file weren’t properly closed. Maybe you can correct it by copying the missing parts from the working file.
If you can share the file I can take a look as well. Sorry I don’t know a standard reliable way to solve issues like this.