Carnac, James Rivett, Sir, 1784-1846, 1st Baronet, Indian administrator