Added fclose to writeFile

need fclose to avoid running out of file handles
Merge pull request #34 from cvisprogrammer/master

added fclose to writeFile