That's probably your magnetron overheating due to either a defect or due to a lack of cooling air flow.
Consult your onwer's manual and check your filters, vents, and air ducts for blockages.
Also, your hood vent exhaust fan and / or internal cooling fan should come on whenever you cook.
See my profile picture if you need to contact me for more free help.
Any microwave with a mis-aligned or loose door is probably leaking excessive microwave energy, and should not be operated unless a leak test is conducted using a calibrated meter. Unless you own such a meter, the oven should be inspected and repaired by a qualified technician. If you need further help, I’m available over the phone at https://www.6ya.com/expert/david_29ad5d1dd86564b0
A thermal cutout could be shutting it down. Check to make sure the cooling fan on the magnetron is functional. If you need further help, I’m available over the phone at https://www.6ya.com/expert/david_29ad5d1dd86564b0