I've been re-reading the reference guide and this may explain it:

If interrupts are used in a program, they must be turned off (masked, not
DISABLEd) before executing a WRITE, and turned back on (if desired) after the
WRITE instruction is complete. An interrupt occurring during a WRITE may cause
it to fail. The following DEFINE turns interrupts off and then back on within a
WRITE command. Do not use this DEFINE if interrupts are not used in the
program.

DEFINE WRITE_INT 1
I'm not using interrupts in this code, so it's not needed - I must of added from one of the previous versions which does use interrupts