Fix style of lib/parser; add error case

- fixes style of lib/parser because I am just the worst.
- adds a test to make sure that tags close before the end of the file.