Instead of manually working out what to roll back in before() or after() why not reset the whole thing? Below is my outline for doing such.
This may be slightly slower. I initially thought a lot slower, but then I discovered I had changed something else in my code that caused a lot of slowdowns. On going back to the original setup it was barely any slower.
There may be downsides I haven’t thought of yet.