I have a website where the customers come and purchase any product. But there are some customers who closes the tab without doing any purchase. I don't want to lose those customers. So
i have decided to provide offers for those customers in the "modal" popup. This popup has to be displayed once the customer clicks the close button in the browser
popup will have a form
What you are trying to do cannot be done. That is after the user has clicked on close there is no way to do it.
But I think what you are looking for is what is called a 'Exit intent popup'.
The idea is simple: you use js/jquery to find if the user is 'about to' close the page(say from mouse movements and such) and display the said popup.
Here is one such plugin : BIOEP
You can just google 'Exit intent popups' for many more.