Perhaps also significant that the script has made a lot of progress but failed at the largest partition encountered.
Be sure to run the script with very few other programs running.
Perhaps look at the whole USB chain. It has been reported that certain USB will not carry fastboot commands (or complex fastboot commands ??). You will need a good quality (full capacity) data cable, so not a thin, skinny cable. Avoid (untested in ADB) USB hubs including any USB hub that might be hidden in the PC / laptop; for the most predictable results check (if necessary with a manual) that you are connecting to a USB-2 port soldered to the motherboard.
Does the PC have plenty of RAM available.