US gymnast, who made headlines after withdrawing from most events at the Tokyo Games to focus on her mental health, earns a seventh career Olympic medal