Don't keep file in memory when it's closed. Fixed #1525
Merge pull request #1715 from dinhviethoa/1525-dont-keep-file-in-memory-when-closed

Don't keep file in memory when it's closed