html: fix inserting missing close tags when a close body tag is encountered