HDFS-7119. Split error checks in AtomicFileOutputStream#close into separate conditions to improve diagnostics. Contributed by Chris Nauroth.

(cherry picked from commit 9f9a2222a2e142a47537bc57ca98fb07a7a78ad4)