Delay in panel when sending email with kirby->email() inside hook

Hello, I have a function in Kirby 3 that sends an email to notify a master editor about newly published articles on the site. But it creates a delay before the popup modal (for changing status) disappear. The duration of the delay (3-6 seconds) is the duration it takes for phpmailer to send the email.

The user can click outside the modal to close it during the delay. Thus, I wonder if I can trigger the modal to close earlier in some way?

I use the page hook page.changeStatus:after inside the config-file to look for status changes. I get the data about the current page and send it successfully with kirby()->email() when the status is set to listed.