The first command in that script clears all the rules from the list.
If the default rule (65535) is "deny ip from any to any", then any and all connections are dropped at that instant.
If the default rule (65535) is "allow ip from any to any", then any connections that are simply routed (not going through NAT) will continue to work, and any connections going through NAT will be dropped.
Then the rest of the script is executed and the rules put back in place. Then new connections go through correctly.