That certainly helped. The script now completed successfully and rebooted my phone. Unfortunately the boot loop persisted.
Setting the boot partition to a helped:
fastboot --set-active=a
Now my phone seems to be in the same condition as when I initially received it. Except for the unlocked bootloader. Many thanks to: @Volker, @yvmuell @hirnsushi