Fixed channel bugs for ending go routines