Add support for locking execution

**DO NOT MERGE YET**
This should fix an issue where concurrent execution of iptables ends up in a deadlock.