Repository: next.js
Issue: Error Connection Closed on Redirect
Labels: bug

### Link to the code that reproduces this issue

https://github.com/unredundant/nextjs-crash-on-redirect

### To Reproduce

1. Start the server in dev mode
2. Go to port 3000 (or, whichever port the web app binds to)
3. Enter the form info (any placeholder email and password will do)
4. Feast you eyes on the glorious crash
5. a reload with cmd r will load the dashboard page as expected, showing the page actually exists.

Confirmed on both pop_os 22.04 and macos whatever they called it (latest)



### Current vs. Expected behavior

I should be able to redirect my web app to another page.

![CleanShot 2023-11-15 at 18 54 07](https://github.com/vercel/next.js/assets/5607577/0a9bcd5c-34de-4745-bd76-85699b38c9ec)


### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:43 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6000
Binaries:
  Node: 20.5.1
  npm: 9.8.0
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 13.5.6
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A
```


### Which area(s) are affected? (Select all that apply)

Not sure

### Additional context

```
web:dev:  ⨯ Error: Connection closed.
web:dev:     at tu (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next/dist/compiled/next-se
rver/app-page.runtime.dev.js:35:303532)
web:dev:     at t.decodeReply (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next/dist/compi
led/next-server/app-page.runtime.dev.js:35:304915)
web:dev:     at /Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next/dist/compiled/next-server
/app-page.runtime.dev.js:38:264
web:dev:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
web:dev:     at async tX (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next/dist/compiled/n
ext-server/app-page.runtime.dev.js:37:5207)
web:dev:     at async rl (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next/dist/compiled/n
ext-server/app-page.runtime.dev.js:38:22994)
web:dev:     at async doRender (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next/dist/serv
er/base-server.js:1407:30)
web:dev:     at async cacheEntry.responseCache.get.routeKind (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/w
eb/node_modules/next/dist/server/base-server.js:1571:28)
web:dev:     at async DevServer.renderToResponseWithComponentsImpl (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/
apps/web/node_modules/next/dist/server/base-server.js:1479:28)
web:dev:     at async DevServer.renderPageComponent (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_m
odules/next/dist/server/base-server.js:1850:24)
web:dev:     at async DevServer.renderToResponseImpl (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_
modules/next/dist/server/base-server.js:1888:32)
web:dev:     at async DevServer.pipeImpl (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next
/dist/server/base-server.js:902:25)
web:dev:     at async NextNodeServer.handleCatchallRenderRequest (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/ap
ps/web/node_modules/next/dist/server/next-server.js:266:17)
web:dev:     at async DevServer.handleRequestImpl (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_mod
ules/next/dist/server/base-server.js:798:17) {
web:dev:   page: '/dashboard'
web:dev: }
```