SPARK-1656: Fix potential resource leaks