High Court criticises HMRC's conduct and compels it to honour its undertakings