bug fix: file not closed

Fix the bug where file might not be closed properly and cause ginkgo tests to fail