Itinerant to relocalized transition of f electrons in the Kondo insulator CeRu4Sn6