Close file handle

On windows, statik fail to rename directory because the temporary file doesn't closed before renaming.