Fix in_tail shutdown race condition problem