Close dialog window if main is closed