SPARK-1656: Fix potential resource leaks

JIRA: https://issues.apache.org/jira/browse/SPARK-1656
I think what you had was actually clearer before. Nested `try`s is a little more complicated. If you were worried about the 1 line duplicate code then maybe you can just add a comment to explain that "outputStream should closed before file is delete" or something.