The government has done "a lot of preparation" for a no-deal Brexit, says the head of the civil service.