SPARK-2134: Report metrics before application finishes

Same reason as in Worker.scala.