Write content if the file's current version is expectedVersion (null = must not exist). Returns the new version.