Add script on click of close icon on a popUp screen in perspective

Hi all,
Is there any way to add script on click of close icon( :heavy_multiplication_x:) on a popUp screen in perspective.

You could make your own close icon

yes...Thanks. Feels like we can also give the script on shutDown of the view and give "if" statement for the script to be executed
Thanks for this :smiling_face: