endSessionDialog: Don't emit 'closed' until handler is connected
Prior to commit 7bd98f3f animation onComplete handlers always occured at least after one main loop iteration.
Now, if animations are disabled, they can get invoked immediately.
That breaks the endSessionDialog button handler, which calls close before setting up the "closed" signal handler.
This commit fixes the handler to get set up first.