SQUASHME: handle write error
SQUASHME: cleanup - substitute 1 with EXIT_FAILURE