handles closed connections