The UV escape fraction of high-redshift galaxies