Connect window to destroy signal to quit event loop.