Fix accounting and padding issues in block_writer
Fix accounting and padding issues in block_writer

These boundary conditions can only be hit with artificially made sparse
files right now. While they can't show up in the wild, it's good to have
the code correct.

fhunleth/fwup,michaelkschmidt/fwup,michaelkschmidt/fwup,fhunleth/fwup,michaelkschmidt/fwup,fhunleth/fwup