after he and his family narrowly avoided capture by the french when they stormed the city in one of the many skirmishes , he had his engineers build a secret escape route out of the palace so his daughters would never come that close to capture again .