Move Spark Program stop call (which in turn close Spark Context) to the place where it was instantiated. Also have small refactoring to simplify the code in the SparkProgramWrapper.