For example say the user code does this:

val x = rdd.count()
sc.stop()

Couldn't there be a stage completion event that is in the queue and gets skipped here?