window: close session immediately when closing the final window

Otherwise we could lose the entire session if any tab is unresponsive.
Thanks to Exalm for debugging it.

Fixes #1445
3 jobs for mcatanzaro/#1445 in 17 minutes and 48 seconds
Status Job ID Name Coverage
  .Pre
passed #1175770
check-code-style

00:01:01

 
  Test
passed #1175771
flatpak
flatpak

00:16:46

passed #1175772
flatpak
flatpak scanbuild

00:05:57