Update filesystem.py

fix WindowsError: [Error 32].
because must close the file before rename the file in window system.