added window close support (#9)