How can I close automatically, a pop up after clicking on update or cancel?

How can I close automatically, a pop up after clicking on update or cancel?

I lauch a pop up by a custom action, to update record by record, i would like that the pop up closes after I click on upadte or cancel.

Thank you.