replace all .close() calls with java7 try/finally blocks + minor refactoring around
remove extra FileOutputStream variable and .flush() call
Merge pull request #156 from Microsoft-CISL/sergiym_try_close

replace all .close() calls with java7 try/finally blocks