William Barr, the Attorney General of the US, will resign his post before his official term expires next year.