Close streams to avoid leakage
Merge pull request #531 from krabaey/feature-close-files

Close streams to avoid leakage