close channel when exception happens