text: Title: [BUG] Opening and ending tag mismatch: meta line 3 and head
  Body: - [x] I've checked [docs](https://rich.readthedocs.io/en/latest/introduction.html) and [closed issues](https://github.com/Textualize/rich/issues?q=is%3Aissue+is%3Aclosed) for possible solutions.
  - [x] I can't find my issue in the [FAQ](https://github.com/Textualize/rich/blob/master/FAQ.md).
  
  **Describe the bug**
  
  Edit this with a clear and concise description of what the bug.
  
  ```py
  
  ansiText = "..."
  width = 80
  
  
  console = Console(width=width, record=True, file=StringIO())
  richText = text.Text.from_ansi(ansiText)
  console.print(richText)
  console.height = len(richText.wrap(console, width=width))
  console.save_html(fileName)
  with sync_playwright() as p:
  		install(p.chromium)
  		browser = p.chromium.launch()
  		page = browser.new_page()
  		page.set_viewport_size({"width": console.width * 3, "height": console.height * 3})
  		page.goto(f"file:///{fileName}")
  		page.screenshot(path=outFile, omit_background=True)
  		browser.close()
  
  ```
  
  Looks to be that the meta tag is not closed 
  
  <meta charset="UTF-8">
  
  
  ![image](https://github.com/Textualize/rich/assets/41634689/ff491241-b8bf-47ab-94bf-cebc075e27f5)
  
  Full implementation at https://github.com/FHPythonUtils/AnsiToImg/blob/master/ansitoimg/render.py
  
  
  **Platform**
  <details>
  <summary>Click to expand</summary>
  
  
  
  ```
  
  ╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
  │ A high level console interface.                                                  │
  │                                                                                  │
  │ ╭──────────────────────────────────────────────────────────────────────────────╮ │
  │ │ <console width=122 ColorSystem.TRUECOLOR>                                    │ │
  │ ╰──────────────────────────────────────────────────────────────────────────────╯ │
  │                                                                                  │
  │     color_system = 'truecolor'                                                   │
  │         encoding = 'utf-8'                                                       │
  │             file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> │
  │           height = 9                                                             │
  │    is_alt_screen = False                                                         │
  │ is_dumb_terminal = False                                                         │
  │   is_interactive = True                                                          │
  │       is_jupyter = False                                                         │
  │      is_terminal = True                                                          │
  │   legacy_windows = False                                                         │
  │         no_color = False                                                         │
  │          options = ConsoleOptions(                                               │
  │                        size=ConsoleDimensions(width=122, height=9),              │
  │                        legacy_windows=False,                                     │
  │                        min_width=1,                                              │
  │                        max_width=122,                                            │
  │                        is_terminal=True,                                         │
  │                        encoding='utf-8',                                         │
  │                        max_height=9,                                             │
  │                        justify=None,                                             │
  │                        overflow=None,                                            │
  │                        no_wrap=False,                                            │
  │                        highlight=None,                                           │
  │                        markup=None,                                              │
  │                        height=None                                               │
  │                    )                                                             │
  │            quiet = False                                                         │
  │           record = False                                                         │
  │         safe_box = True                                                          │
  │             size = ConsoleDimensions(width=122, height=9)                        │
  │        soft_wrap = False                                                         │
  │           stderr = False                                                         │
  │            style = None                                                          │
  │         tab_size = 8                                                             │
  │            width = 122                                                           │
  ╰──────────────────────────────────────────────────────────────────────────────────╯
  ╭── <class 'rich._windows.WindowsConsoleFeatures'> ───╮
  │ Windows features available.                         │
  │                                                     │
  │ ╭─────────────────────────────────────────────────╮ │
  │ │ WindowsConsoleFeatures(vt=True, truecolor=True) │ │
  │ ╰─────────────────────────────────────────────────╯ │
  │                                                     │
  │ truecolor = True                                    │
  │        vt = True                                    │
  ╰─────────────────────────────────────────────────────╯
  ╭────── Environment Variables ───────╮
  │ {                                  │
  │     'TERM': None,                  │
  │     'COLORTERM': 'truecolor',      │
  │     'CLICOLOR': None,              │
  │     'NO_COLOR': None,              │
  │     'TERM_PROGRAM': 'vscode',      │
  │     'COLUMNS': None,               │
  │     'JUPYTER_COLUMNS': None,       │
  │     'JUPYTER_LINES': None,         │
  │     'JPY_PARENT_PID': None,        │
  │     'VSCODE_VERBOSE_LOGGING': None │
  │ }                                  │
  ╰────────────────────────────────────╯
  platform="Windows"
  rich==12.6.0
  ```
  
  
  
  </details>
  