Added close file in WriteYaml

This will fail on windows if the file is still open when renaming
Merge pull request #7 from gabriel-samfira/close-file-in-WriteYaml

Added close file in WriteYaml