Pulsar distances and the galactic distribution of free electrons