Headlight circuits are usually on an auto-reset thermal circuit breaker. The fact that it stayed on for a while, went off, then back on-off indicates that the breaker is likely cycling due to an overload.
A short circuit would immediately shut the high beams off and they would stay off. The circuit breaker is seeing an overload that takes a little while to trigger it. Then after it cools enough, it turns the lights back on.
I would try replacing the breaker first. The breakers have been known to be defective once in a while. Check the owner's manual for the high-beam circuit breaker location. It usually plugs into a fuse box or electrical center.
If that doesn't work, you will have to find the source of an overload, which can get time-consuming.
Steve