Sergio Perez and Carlos Sainz were battling for third in the closing laps of the Azerbaijan Grand Prix when they crashed on the run to the third corner, virtually ending the race.