By default, Spark jar, app jar, and cache files are configured to be deleted after the job. If you want to preserve these files you will have to change the configuration. You can do it using the following command:
val sc = new SparkContext(new SparkConf())
./bin/spark-submit <all your existing options> --spark.yarn.preserve.staging.files=true