html: don't crash for close tags not in scope

Given a HTML document like:

	<p><i>Test</p><p>case</i></p>

the 'i' close tag is not in scope when encountered. This caused
the tree construction algorithm to crash.

Now, only close tags that have an element in scope are closed.
Otherwise, they are ignored.