Fixes error during remove_all after renaming an opened file
Merge pull request #668 from Andr3as/master

Fixes error during remove_all after renaming an opened file