diff --git a/pd/nw/dialog_canvas.html b/pd/nw/dialog_canvas.html
index 5d93dc3776837102bd6645558cdf8f542a3ee07e..65227f5955526dc49550092c751bb180d5a8d36b 100644
--- a/pd/nw/dialog_canvas.html
+++ b/pd/nw/dialog_canvas.html
@@ -754,7 +754,7 @@ function add_events(name) {
         //pdgui.pdsend(name + " menuclose 0");
         //cancel();
         pdgui.remove_dialogwin(pd_object_callback);
-        this.close(true);
+        gui.Window.get().close(true);
     });
     pdgui.dialog_bindings(name);
 }
diff --git a/pd/nw/dialog_font.html b/pd/nw/dialog_font.html
index a1568f224ae26c3f43ffebfc4aa2767d8043e263..390c125b88d19bcf73242059f115f48a28b8f019 100644
--- a/pd/nw/dialog_font.html
+++ b/pd/nw/dialog_font.html
@@ -186,7 +186,7 @@ function add_events(name) {
         //pdgui.pdsend(name, "menuclose 0");
         //cancel();
         pdgui.remove_dialogwin(pd_object_callback);
-        this.close(true);
+        gui.Window.get().close(true);
     });
     pdgui.dialog_bindings(name);
 }
diff --git a/pd/nw/dialog_gatom.html b/pd/nw/dialog_gatom.html
index 1600e3c0d410979f89f5fc098f6dcd63fe6c67bb..ab5d895ed880c74bde8c054074f53afd9feac75d 100644
--- a/pd/nw/dialog_gatom.html
+++ b/pd/nw/dialog_gatom.html
@@ -275,7 +275,7 @@ function add_events(name) {
         //pdgui.pdsend(name, "menuclose 0");
         //cancel();
         pdgui.remove_dialogwin(pd_object_callback);
-        this.close(true);
+        gui.Window.get().close(true);
     });
     pdgui.dialog_bindings(name);
 }
diff --git a/pd/nw/dialog_iemgui.html b/pd/nw/dialog_iemgui.html
index 4a7d31add7256579681e4068fa287ba9460e5434..7f6ab7497f690b3a26221d76639551e42d8a9a13 100644
--- a/pd/nw/dialog_iemgui.html
+++ b/pd/nw/dialog_iemgui.html
@@ -559,7 +559,7 @@ function add_events(name) {
         //pdgui.pdsend(name, "menuclose 0");
         //cancel();
         pdgui.remove_dialogwin(pd_object_callback);
-        this.close(true);
+        gui.Window.get().close(true);
     });
     pdgui.dialog_bindings(name);
 }
diff --git a/pd/nw/dialog_prefs.html b/pd/nw/dialog_prefs.html
index ebcbdb1f2bb15c9a54d22f150bac618326d20740..ba491c778c50a710c0a9cb94dd74cf9c52ec96de 100644
--- a/pd/nw/dialog_prefs.html
+++ b/pd/nw/dialog_prefs.html
@@ -634,7 +634,7 @@ function add_events(name) {
     gui.Window.get().on("close", function() {
         // this needs to do whatever the "cancel" button does
         pdgui.remove_dialogwin(pd_object_callback);
-        this.close(true);
+        gui.Window.get().close(true);
     });
     pdgui.dialog_bindings(name);
 }