Fix deadlock caused by race condition between internal_goal_callback and accept_new_goal