Proper exception handling while writing to hdfs.
Removed unnecessary code.