The closed property will return a Boolean value of true if the target window has been closed, and false it is open.
To demonstrate how it works we will create a page that has a popup generator that will keep generating the popup window on a timed interval if the user happens to close it. This script is geared to check to see if a window has been closed before trying to reopen it by using the "closed" property to perform an evaluation before we execute some code.
If you are looking for a script that will do something when a user tries to close the main browser window instead, you can find that fully explained with an example here in video and script form:
Javascript Trap User for Unsaved Work Tutorial Textarea Check Before Leave