using with construct

using with construct so that the file closes smoothly
Merge pull request #14 from yasoob/patch-1

Makes sure data file closes smoothly using with.