better handling of closed connections

which results in better stability, since unused goroutines are properly
stopped