Tentative agreement comes hours ahead of federal trial with allegations that distributors failed to stop suspicious orders of drugs from being shipped despite warnings of misuse