Improve error messages for invalid commadn ends ({/invalid}), invalid escape codes ({\p}), and incorrect nesting of control tags ({/if})