added window event catching (for abnormal exits by usr)