exit when out channel is closed