Properly close versionfile