Sometimes dryer stops mid cycle

My 5-year old dryer once every 6 to 10 drying cycles just stops in mid cycle leaving laundry wet. It stops like it is finished but it is not. This is happening on the Timed Cycle. It stops well before it supposed to. Few times I heard from another room dryer stop and start spinning two or three time within few seconds. Like someone was playing with an on/off switch. By the time I got to the laundry room, it was running fine.
This has been going on for past few years…. It is not getting worst but it is very annoying.

Can anyone help me get a procedure what button to push to read the error codes from the diagnostics?

Anyone has a maintenance manual for it so I can take it apart to check electrical connections?

Thanks,