Dialogs now call close() before being deleted.

This is necessary to block and join with the rendering thread in
closeEvent() before the context is destroyed.
Implementing closeEvent to join with spire thread.

Must be done before the context is destroyed by GLWidget.