Fixes #6187 - Rewrite library environment destroy in dynflow