Fixes error during remove_all after renaming an opened file

If you rename an opened file and close it later by close all, it throws always an error.
![error](https://cloud.githubusercontent.com/assets/4389878/3559025/11a33e0c-0944-11e4-8194-3c1fd8fc2281.jpg)