Overhaul of write code

The file header is now constructed on modio_finalise_write instead of
procedurally on each modio_push call. This makes the system overall more
modular and flexible as modio_finalise_write can be called individually
without fear of corrupting or having an invalid header. This also fixes
an issue with force-writing in modio_push.

Also added a big load of comments that explain all the new header stuff.
Update README.md