Close lightbox after saving page

Hello everybody,
Can someone tell me how to automatically close a lightbox after the form of the page that called it is saved?

I specify that I don’t need to close the lightbox after a set time or even create a button to close it. Instead, I need that after submitting the form save, a waiting lightbox opens and only when the data has been saved does it close to send to another page.

I’ve tried creating a promise.all that includes opening the lightbox and loading wixlocation before saving, I’ve tried inserting a hook, but none seem to work. Solutions? I would be very grateful.