Aston Martin's Fernando Alonso almost collided with Ferrari's Charles Leclerc during opening practice at Imola.