### Bug description

Let's say my file is called hello.qmd. 

After previewing as PDF with a fixed port number, localhost:4048 is pointing at `localhost:port/web/viewer.html`.

If I then stop the previous preview and run a new HTML preview, it will not point to `localhost:port/hello.html` as it should, but rather keeps pointing at `localhost:4048/web/viewer.html`. Here, it says 404 (Not found).

If I manually type `localhost:4048/hello.html`, the preview works as expected there. So the preview is generated at the right localhost port, but localhost:4048 will not resolve to it.

If I open localhost:4048 in a private window, it works as expected. If I open it in Edge rather than Firefox, it works. However, that's only because the PDF preview wasn't loaded in Edge before the HTML preview. If I open a PDF preview in Edge, and afterwards do a HTML preview and open localhost:4048 in Edge, it will also still point to `localhost:port/web/viewer.html`.

### Steps to reproduce

I am just testing using the Hello.qmd demo.

1. First, I run this command to preview as PDF:
`quarto preview "absolute_file_path" --to pdf --no-browser --watch-inputs --port 4048`
2. Then, I open localhost:4048 and verify that the preview is working.
3. I stop the PDF preview process. In some cases I stopped Deno in task manager or using:
`Get-Process -Id (Get-NetTCPConnection -LocalPort "4048").OwningProcess | Stop-Process`
4. After the PDF preview process is stopped, I preview the same document as HTML using 
`quarto preview "absolute_file_path" --to html --no-browser --watch-inputs --port 4048`
5. I open `localhost:4048`, and it resolves to `localhost:port/web/viewer.html`.
6. I manually type `localhost:4048/Hello.html` and it works.
7. I open a Private Firefox window and go to `localhost:4048`. It correctly resolves to `localhost:4048/Hello.html`

````qmd
---
title: "Penguins, meet Quarto!"
format: html
editor: visual
---

```{r}
#| label: load-packages
#| include: false

library(tidyverse)
library(palmerpenguins)
```

## Meet Quarto

This is a test. This is another test. This is a test. New text. New text. This is quite fast. Testing. Testing testing testing. Testing number. Retest.

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.

## Meet the penguins

![](https://raw.githubusercontent.com/quarto-dev/quarto-web/main/docs/get-started/hello/rstudio/lter_penguins.png){style="float:right;" fig-alt="Illustration of three species of Palmer Archipelago penguins: Chinstrap, Gentoo, and Adelie. Artwork by @allison_horst." width="401"}

The `penguins` data from the [**palmerpenguins**](https://allisonhorst.github.io/palmerpenguins "palmerpenguins R package") package contains size measurements for `r nrow(penguins)` penguins from three species observed on three islands in the Palmer Archipelago, Antarctica.

The plot below shows the relationship between flipper and bill lengths of these penguins.

```{r}
#| label: plot-penguins
#| warning: false
#| echo: false

ggplot(penguins, 
       aes(x = flipper_length_mm, y = bill_length_mm)) +
  geom_point(aes(color = species, shape = species)) +
  scale_color_manual(values = c("darkorange","purple","cyan4")) +
  labs(
    title = "Flipper and bill length",
    subtitle = "Dimensions for penguins at Palmer Station LTER",
    x = "Flipper length (mm)", y = "Bill length (mm)",
    color = "Penguin species", shape = "Penguin species"
  ) +
  theme_minimal()
```
````

### Expected behavior

I would expect that localhost:4048 would always resolve to the currently running preview, and not be stuck on the PDF viewer url.

### Actual behavior

After previewing as PDF, localhost:4048 will only resolve to `localhost:port/web/viewer.html` at that port.

### Your environment

- Running a shell command from the Obsidian markdown editor using the [Shell commands plugin.](https://github.com/Taitava/obsidian-shellcommands)
    - Obsidian 1.3.5 (latest)
    - Shell commands 0.19.1 (latest)
- OS: Windows 10

Although Shell commands is sending the commands, I can reproduce it but running the commands myself in cmd.exe.

### Quarto check output

```bash
A new release of Deno is available: 1.28.2 → 1.34.2 Run `deno upgrade` to install it.

[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.55.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.3.361
      Path: C:\Users\User\AppData\Local\Programs\Quarto\bin
      CodePage: 1252

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....OK
      Version: 3.10.11
      Path: C:/Users/User/AppData/Local/Programs/Python/Python310/python.exe
      Jupyter: 4.10.0
      Kernels: python3

[>] Checking Jupyter engine render....OK

[>] Checking R installation...........OK
      Version: 4.2.3
      Path: C:/PROGRA~1/R/R-42~1.3
      LibPaths:
        - C:/Users/User/AppData/Local/R/win-library/4.2
        - C:/Program Files/R/R-4.2.3/library
      knitr: 1.42
      rmarkdown: 2.20

[>] Checking Knitr engine render......OK
```
cderv
2023-06-11T23:15:20Z
MSBack
bug windows
v1.4
closed
After previewing as PDF from CLI with fixed port, localhost keeps pointing at PDF viewer when previewing as HTML etc.
https://github.com/quarto-dev/quarto-cli/issues/5882