clearing state after end window