It occurs to me that, in actual practice, there's a set of common HTML tags that virtually always need closing. This suggests it might be fine to just keep a list of such tags, scan backwards until you find such a tag and, if any was found, close it when the user types "</". These are tags like <a>, the font attribute tags (<font>, etc.) etc.
Wouldn't be perfect, but might be acceptable (especially if the main "error" is simply failing to supply any tag closure). Fancier heuristics are possible, but I wonder if that one alone might not be good enough.