fixed properly terminating StreamHandler