access window function when context destructs is a bad thing

probably application is also shutting down at the same time and it might
cause crash.