[SPARK-2506]: In yarn-cluster mode, ApplicationMaster does not clean up corre...

...ctly at the end of the job if users call sc.stop manually. There are two minor bugs:

1. At the end of a job, "ApplicationMaster" will ask for resources and launch containers repeatedly. These newly launched containers keep trying to contact with the already-stopped driver and fianally fail. When the container failure number reaches the max value, this job's FinalStatus wil be marked as FAILED.
2.  After the driver asks to stop executors, "BlockManager" of executors will try to contact  the already-stoppped "BlockManagerMasterActor" of the driver. Unfortunately, all the connecting attempts will fail, and then the executor process will crash with a non-zero Exit Code.