don't keep files permanently opened
fix some undefined variable errors
Merge pull request #33 from JuliaLang/tk/close-files

don't keep files permanently opened