Fixed #321, Closing files when renaming