Is it possible to detect if an OW app window is closed?

I want to catch close event: when the user clicks on the close button. is it possible? is it possible to detect if the window is closed?
Maybe something like Window: beforeunload event - Web APIs | MDN

In case you have more than one window, you can access the window object of any window via overwolf.windows.getOpenWindows().
You can also try to use: overwolf.windows.onStateChanged. it might suffice.