string will be displayed in the file filter list of Windows file
         selectors.
 
-        filter is an appropriate file filter such as *.txt.
+        filter is an appropriate file filter such as \*.txt.
 
         dir is the default directory to use for file selectors.
 
         for document in self._docs[::-1]:  # Close in lifo (reverse) order.  We clone the list to make sure we go through all docs even as they are deleted
             if not self.CloseDocument(document, force):
                 return False
-            document.DeleteAllViews() # Implicitly delete the document when the last view is removed
+            if document:
+                document.DeleteAllViews() # Implicitly delete the document when the last view is removed
         return True