That is much more complex.
When the browser receives in a page a download link, the actual download process is no longer happening in the context of the page. The browser handles the file download process and it does not inform the page that the download finished. That is just the way the current HTML5 implementation and browser architecture works.
If you want to be 100% deterministic, you need to create a new widget which downloads the file internally and then allows you to either open or save. Downloading the file in the document allows you to understand then the download finished and then you can trigger a "FileDownloaded" widget Event .
I've googled a link that shows how you can do this: https://stackoverflow.com/questions/23451726/saving-binary-data-as-file-using-javascript-from-a-browser/23451803#23451803
It should be relatively easy to do, if you have previous widget building experience 😉