my statement above might be unclear:
at this step, I think the write_gpt.sh script tries to wipe out the old GPT partition tables (by doing 2 'dd' of 32MB from /dev/zero )
here the first one (supposed to be the 32MB of the first GPT table) succeeded, the second one (supposed to be the last 32MB of the eMMC where the secondary partition resides) fails.
one possible cause I have seen long time ago was that the eMMC is actually pointing to its boot area rather than the user area (I think modern linux kernels has something in the eMMC driver ensuring this is not happening and the user area is selected properly)
or the eMMC is somehow broken.