How to noify the framework when application closes