Ensure policies only close the state after all other nodes that may mutate the state are complete (#38775)