added better error message for missing closing tags