SPARK-4454 Fix race condition in DAGScheduler

Simple fix to race condition