sounds like a low voltage shutdown because the trim motor load on battery caused voltage drop - check ALL battery and other cables for any sign of corrosion, don't forget the connections under the engine cover.
I've experienced similar where the trim was wired to the same fuse as the ignition on the engine and trimming at speed caused the fuse to pop, moved the trim to a dedicated fuse and all good.
The load on a trim motor when trying to push the prop backwards (trim up) under speed (fighting push of prop) is VERY large, takes a lot of current to trim up under speed, and can frequently be over looked.