IIRC `<qt/>` is just a minimal marker to mark a field as rich text. It is not meant as a document tag around the content. Or do you have some source saying otherwise?
In any case, if this change is necessary, the closing tag should be corrected to:

    tooltip = "<qt>" + HtmlEscape(tooltip, true) + "</qt>";