[closetag addon] Improve heuristic for seeing if closing tag already exists

Issue #2557