Fix up mismatched tags

A recent edit reordered closing tags in a sequence compared to
the opening tags - we have a strict requirement to preserve
nested tag order.  Drive-by fix cleaning up section references
along the way.