Replaces the current document with a valid HTML document using HTMLDocument.open, writeln and close.