McLaren's Lando Norris narrowly avoided crashing into the wall twice while leading the Singapore Grand Prix.