defer file close to fix issue #604

closing the file too early keeps the profiling from writing out to the file.
Merge pull request #611 from jhawk28/patch-1

remove file close to fix issue #604