A couple of minor mods.
The error blink will repeat 5 times.
I try to do f_open several times.
I don't delete the flash file after a successful flash.