In the last medal event for women’s artistic gymnastics, Brazil’s Rebeca Andrade narrowly edged American Simone Biles for the gold.