Patch #1594554: Always close a tkSimpleDialog on ok(), even
if an exception occurs.
Will backport to 2.5.
diff --git a/Lib/lib-tk/tkSimpleDialog.py b/Lib/lib-tk/tkSimpleDialog.py
index 02ea034..4450484 100644
--- a/Lib/lib-tk/tkSimpleDialog.py
+++ b/Lib/lib-tk/tkSimpleDialog.py
@@ -129,9 +129,10 @@
         self.withdraw()
         self.update_idletasks()
 
-        self.apply()
-
-        self.cancel()
+        try:
+            self.apply()
+        finally:
+            self.cancel()
 
     def cancel(self, event=None):