Yes, that typo doesn’t exist in the actual script, Safari has some spell-correcting in place that misfires on occasion.
I would suggest two things:
1) Examine the pwsh process with dtruss while attempting to reproduce
the issue, to give some hint of whether QUIT is actually being
received. Maybe you can figure out from where.
This is what I see when I target the zsh parent process (I got sidetracked with the pwsh process, which seems rather noisy from a syscall standpoint)
SYSCALL(args) = return
dtrace: error on enabled probe ID 1657 (ID 258: syscall::sigprocmask:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 1657 (ID 258: syscall::sigprocmask:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2212 (ID 270: syscall::ioctl:return): invalid user access in action #5 at DIF offset 0
dtrace: error on enabled probe ID 2082 (ID 530: syscall::sigreturn:return): invalid user access in action #5 at DIF offset 0
2) Try using "exec /usr/local/bin/pwsh ..." in the script so the zsh
parent is removed from the process tree, and then try to reproduce the
issue.
This makes it so that the reproduction steps I listed before no longer lead to the crash.