diff --git a/baas/index.html b/baas/index.html
index 1db5b329d312967c8b196577f4bcfaebae91089f..26cee41caeecdaef9e4bfd6b5d107ed6ac5bc5d9 100644
--- a/baas/index.html
+++ b/baas/index.html
@@ -48,10 +48,15 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
             win.resizeTo(900, 750);
             win.focus();
 
-            win.on('close', function() {
-              this.hide(); // Pretend to be closed already
-              kill_processes();
-              this.close(true);
+            process.on('exit', function(code) {
+                console.log("Process exiting with code " + code);
+                kill_processes();
+            });
+            process.on('SIGINT', function() {
+                process.exit();
+            });
+            process.on('SIGTERM', function() {
+                process.exit();
             });
 
             $(document).ready(function() {