Close modal automatically after task execution

Hello,
I am developing an application page and on my main page the tasks are opened within a modal that I developed following this tutorial (https://documentation.bonitasoft.com/bonita/7.5/uid-modal-tutorial)
I would like it to function as the default Portal and after the task has been executed, the modal closes automatically.

How do I close automatically the modal after executing the task?

Within the modal I am using an iframe to open the task.

Iframe Code -

Hello - I advise you to use the Modal Container coming with the 7.8 release, there is a redirection property in case of success that you might be able to leverage to achieve this. Here is the official documentation in case you are interested.