Fixed unclosed directive error messages at end of file where the wrong unclosed directive name was reported