YARN-2724. Skipped uploading a local log file to HDFS if exception is raised when opening it. Contributed by Xuan Gong.

(cherry picked from commit e31f0a6558b106662c83e1f797216e412b6689a9)