Revert "Fix ressource leaks"

This reverts commit 17d834d044a7554989022d0497241dc6f32c00ea.