I am using a library which needs to be cleaned up at exit time (i.e. closing a socket so that it does not hang until some timeout) in an OpenFL 2.2.1 application.
However, I could not find any event which is called when I close the window with Alt+F4
or the closing button of the window.
How can I detect that the application is terminating, in order to clean my resources?