There's no easy answer to this.
Basingstoke is a particular problem for us, as we go from platform 5, which is a bay. Even if I leave it 'til 10 seconds before departure time before giving the driver the 'close doors', I can guarantee that some poor soul will come bombing round the corner...