Teva Pharm second-quarter profit slightly beats profit forecast