Add proper dispatcher shutdown codes