fix run.sh so that old file gets overwritten only when complete
fix run.sh so that old file gets overwritten only when complete

joequant/cycle-detector,joequant/cycle-detector,joequant/cycle-detector,joequant/cycle-detector