This commit makes sure that files that are generated in a temporary directory are closed once the related test completes.