SPARK-2134: Report metrics before application finishes

Actually one other thing, add `: Unit =` here. The procedure syntax in Scala (`def f() { ... }`) is going to be deprecated in terms of always specifying a return type.