Improve error logging when writing upgrades to disk