The page in the link you provided says:
FileSaver.js implements the HTML5 W3C saveAs() FileSaver interface in browsers that do not natively support it.
The linked page, pointing to the spec for filesaver, says it supports the following significant event:
onwriteend of type Function
Handler for writeend events.
That's what you need to use. The save operation, like most significant things in javascript, is an asynchronous event.
You want to catch the end of the write operation, and then close the window:
canvas.toBlob(function (blob) {
var filesaver = saveAs(blob, "RQGantt.png");
filesaver.onwriteend = function() { window.close(); }
}
EDIT
Unfortunately, it looks like this isn't available. See: https://github.com/eligrey/FileSaver.js/issues/1
Perhaps you can ask the writer of the plugin to revisit the issue.
The best I can suggest is add a button that lets the user click to close. On click, you can call abort, as shown in the github page, and assume it will exit cleanly if it's already finished. Then do a window.close.