Signal-triggered shutdown (SIGTERM/SIGHUP) now emits session_shutdown before any terminal writes, and SIGHUP no longer hard-exits, so extension resources (e.g. sockets) are released and the terminal is restored even when the terminal is gone. A genuinely dead terminal still exits without hot-spinning via the EIO error path. closes #5080