Second EU referendum must be held on final Brexit deal, says former head of British civil service