That happens - as best I can understand - because the print statements open the UART and expect a connection (indicated by RTS/CTS flow control?) to something that can accept what your are print-ing
Once you unplug the board from the computer and set it to autorun the UART connection doesn't exist, so the print statements start filling the small internal serial buffer up. When full everything stops until a UART is connected.
For autorun deployments I simply comment out the print statements. That works well for me with thousands of transmissions using that script you based yours on.
I think there is also a way to set print to go somewhere else other than UART (something like NULL work work great) but I'm not sure how.
Hope that helps.