The script was: sleep 1 minute, then restore rules, sleep 1 more minute, then reboot.
That first rule restore was so I could conceivably get things back in order before the reboot. I had the final reboot there in case the new firewall rules somehow killed my ssh session. This never happened, and I might have been able to ssh in again at that point, but I wasn't going to count on it.