fix leak with files not cleaning up correctly
Merge pull request #855 from metamx/fix-leak

fix leak with files not cleaning up correctly