Fix for #814, Memory Leak

File isn't closed before being released, it leaks. This test has been verified and tested many times.
Fix indentation (cosmetic)
Merge pull request #1608 from supcik/fix_indent

Fix indentation (cosmetic)
Merge pull request #1383 from bjelojac/patch-1

Fix for #814, Memory Leak