See the question and my original answer on StackOverflow

The current code always closes the unclosed nodes just before the parent node is closed. So the following code

var doc = new HtmlDocument();
doc.LoadHtml("<x>hello<y>world</x>");
doc.Save(Console.Out);

will output this (the unclosed <y> is closed before the parent <x> is closed)

<x>hello<y>world</y></x>

Originally, the option, when set, was meant to be able to produce this instead (not for XML output types):

<x>hello<y>world</x></y>

with the closing <y> set at the end of the document (that's what the "end" means). Note in this case, you can still get overlapping elements.

This feature (maybe useless I can admit that) was broken somewhere in the past, I don't know why.

Note <p> tag case is special as it's by default being governed by custom HtmlElementFlag. This is how it's declared in HtmlNode.cs:

ElementsFlags.Add("p", HtmlElementFlag.Empty | HtmlElementFlag.Closed);