BOSTON — CVS Health Corp. has agreed to pay Massachusetts $795,000 and will tighten its policies for dispensing opioids following an investigation into its drug prescription practices, Attorney General Maura Healey said Thursday. Healey said a settlement reached between the state and the Woonsocket, Rhode Island-based drug store giant resolves past allegations. Prior to March