Fix for #814, Memory Leak

File isn't closed before being released, it leaks. This test has been verified and tested many times.
Merge pull request #1383 from bjelojac/patch-1

Fix for #814, Memory Leak