Fix test teardown in IPv4 and IPv6 tests