Version beta.002 released at the same link.
Added some string length checking for crazy inputs.
Added check that the header table fits completely inside a maximum (2Gb) file.
I tested by creating a combined map from Amsterdam and Helsinki at zoom level 14. It's a foolish effort, header contains over 600000 empty tiles (7.2Mb)! Took a couple of minutes to create. Not recommended practice, but it worked.
zoom, min x, max x, min y, max y, (act/area)
14, 8410, 9323, 4701, 5391, (157/631574)