Ferrari's Charles Leclerc took pole position ahead of Max Verstappen and Valtteri Bottas despite crashing out in Q3.