> The only thing missing is that I can't close the tab using JavaScript when it's finished, so the user (usually me) has to close it himself.
how come? doesn't window.close() work for you?
save(event) {
...take the action you wanted...
window.close()
}
<button onclick="(event) => save(event)">