Fixing a bug with XML_CloseTag() function