[SPARK-4787] Ensure that call to stop() doesn't lose the exception by using a finally block.