The U.S. Department of Justice announced Wednesday it had closed criminal and civil investigations with Stamford-based Purdue Pharma and that the company had agreed to plead guilty to three federal criminal charges and pay more than $8 billion.