HDFS-7080. Fix finalize and upgrade unit test failures. (Arpit Agarwal)