How do I close the popup when the user clicks on the Dark

How do I close the popup when the user clicks on the Dark background? I want user to have two ways to close the popup:

1. By clicking on X on left upper corner.
2. Click anywhere outside the message area.

Can someone please help!

Amar