Everything here is my opinion. I do not speak for your employer.
There is no such thing as reliably cleaning up after a test failure. If you could do things reliably, the test wouldn't have failed.
Try my project! Tailscale: a new, magically easy mesh VPN based on WireGuard.