SPARK-2134: Report metrics before application finishes

minor: but could you move this a few lines down right before we stop the metrics systems? It will make be slightly more readable if we group related things together