Run cleanup after end of reroll.

Also use bash instead of sh