Sir Samuel Romilly (1757–1818), Solicitor-General