fixed bug where logger can loop forever when stopChan is closed