Merge "Ensure the profile is written to disk at shutdown"