Bug 738329 - xcf_seek_pos() can cause unexpected OS behavior

Change XCF saving to never seek past the end of the partially written
file. The only places where we still did this was when skipping the
offset tables for layers, channels, levels and tiles.

Now we write an all-zero offset table first, and then only seek around
in areas of the file that already exist. This also simplifies the code
a bit. Changed comments to make it clear what happens.

(cherry picked from commit 5a4d865358818fdbae203716bd6e33f86f5905c6)