text: Title: [BUG] Trailing newlines when using progress bar in notebook
  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**
  First of all, thanks a lot for this library!
  Displaying a progress bar in a jupyter notebook leads to several trailing newlines being added, seemingly when the progress bar completes. The issue doesn't occur when running the same code in a terminal. Might be related to #2711.
  
  ![image](https://user-images.githubusercontent.com/46298009/214563530-a9c9e25f-8469-40d0-84c1-de80766f6e67.png)
  <details>
  <summary> Click to see source code </summary>
  
  ```python
  from time import sleep
  from rich.progress import Progress
  
  with Progress() as progress:
      task = progress.add_task("Working", total=10, metrics="")
      for batch in range(10):
          sleep(0.1)
          progress.update(task, advance=1, refresh=True)
  print("There's a lot of space above me")
  ```
  </details>
  
  **Platform**
  <details>
  <summary>Click to expand</summary>
  
  ```python
  ╭────────────────────── <class 'rich.console.Console'> ──────────────────────╮
  │ A high level console interface.                                            │
  │                                                                            │
  │ ╭────────────────────────────────────────────────────────────────────────╮ │
  │ │ <console width=115 ColorSystem.TRUECOLOR>                              │ │
  │ ╰────────────────────────────────────────────────────────────────────────╯ │
  │                                                                            │
  │     color_system = 'truecolor'                                             │
  │         encoding = 'utf-8'                                                 │
  │             file = <ipykernel.iostream.OutStream object at 0x7f799c8dc9d0> │
  │           height = 100                                                     │
  │    is_alt_screen = False                                                   │
  │ is_dumb_terminal = False                                                   │
  │   is_interactive = False                                                   │
  │       is_jupyter = True                                                    │
  │      is_terminal = False                                                   │
  │   legacy_windows = False                                                   │
  │         no_color = False                                                   │
  │          options = ConsoleOptions(                                         │
  │                        size=ConsoleDimensions(width=115, height=100),      │
  │                        legacy_windows=False,                               │
  │                        min_width=1,                                        │
  │                        max_width=115,                                      │
  │                        is_terminal=False,                                  │
  │                        encoding='utf-8',                                   │
  │                        max_height=100,                                     │
  │                        justify=None,                                       │
  │                        overflow=None,                                      │
  │                        no_wrap=False,                                      │
  │                        highlight=None,                                     │
  │                        markup=None,                                        │
  │                        height=None                                         │
  │                    )                                                       │
  │            quiet = False                                                   │
  │           record = False                                                   │
  │         safe_box = True                                                    │
  │             size = ConsoleDimensions(width=115, height=100)                │
  │        soft_wrap = False                                                   │
  │           stderr = False                                                   │
  │            style = None                                                    │
  │         tab_size = 8                                                       │
  │            width = 115                                                     │
  ╰────────────────────────────────────────────────────────────────────────────╯
  
  ╭─── <class 'rich._windows.WindowsConsoleFeatures'> ────╮
  │ Windows features available.                           │
  │                                                       │
  │ ╭───────────────────────────────────────────────────╮ │
  │ │ WindowsConsoleFeatures(vt=False, truecolor=False) │ │
  │ ╰───────────────────────────────────────────────────╯ │
  │                                                       │
  │ truecolor = False                                     │
  │        vt = False                                     │
  ╰───────────────────────────────────────────────────────╯
  
  ╭────── Environment Variables ───────╮
  │ {                                  │
  │     'TERM': 'xterm-color',         │
  │     'COLORTERM': 'truecolor',      │
  │     'CLICOLOR': '1',               │
  │     'NO_COLOR': None,              │
  │     'TERM_PROGRAM': 'vscode',      │
  │     'COLUMNS': None,               │
  │     'LINES': None,                 │
  │     'JUPYTER_COLUMNS': None,       │
  │     'JUPYTER_LINES': None,         │
  │     'JPY_PARENT_PID': '18491',     │
  │     'VSCODE_VERBOSE_LOGGING': None │
  │ }                                  │
  ╰────────────────────────────────────╯
  
  platform="Linux"
  ```
  </details>
  