Regularity of the distance function from arbitrary closed sets