Appeals against the approval of a plan to restructure Thames Water through a loan of up to £3 billion has been dismissed, Court of Appeal judges have said.