Thames Water is edging closer to a multibillion pound rescue deal with its lenders that would keep the ailing utility out of temporary public ownership.