Probably a more elegant solution available, but:
Grab gene locations in BED format. Generally you can do this fairly easily using the UCSC Table Browser and their
Use bedops closest-feature with the
--distflag to calculate distances. Make sure to sort files correctly before running this step using bedops
sort-bedfunction or you'll get weird results.