Improve reliability of Learn environment switch logic when directories are missing. Prevent concurrent updates to gradle.properties from causing missing properties