Use bracket for freeing
Add freeing functions
Bump deps
Add env shutdown