in my case, I close the modal page when the end user clicks Apply Changes button without doing any changes , or when clicking Cancel button. In this case there is no process to be executed consequently the modal page will not Auto Close, and it will go to page 102.

So, I put this code in a DA of the page 102 to be fired on page load, to Auto Close the modal page.... in your case you can execute that code on a button click ...