added window close support (#15)