Some funcatexit fixes

Prevent `funcatexit` from spoiling `env.save()` with unpickable objects and raise `TestWarn` in case test went well but the cleanup failed.