public async Task CloseDocumentEditor (IDocumentEditor editor, bool unbindUI, bool deleteThumbnail, bool reloadThumbnail) { var docRef = editor.DocumentReference; if (docRef == null) return; var doc = docRef.Document; if (doc == null) return; Debug.WriteLine ("CLOSE " + docRef.File.Path); if (!doc.IsOpen) return; docRef.IsNew = false; Settings.LastDocumentPath = ""; try { await docRef.Close (); editor.UnbindDocument (); if (unbindUI) { editor.UnbindUI (); } InvalidateThumbnail (docRef.File, deleteThumbnail:deleteThumbnail, reloadThumbnail:reloadThumbnail); } catch (Exception ex) { Debug.WriteLine (ex); } }