The gas dryer has three steps to get heat and stay going. One is the flame igniter, Two is the low flame pilot coil. Three is the main gas valve. We set up the dryer to run and although it is noisy listen for a click as the drum gets to speed, this turns on the igniter. The igniter is a heating element much like the filament in a light bulb, it glows hot. Then the lo heat or pilot valve is turned on and you hear another click. The gas is let out to the igniter and lights a flame. If the flame sensor feels the heat and sees the flame then the third and final click will energize the main gas valve and a much larger flame will come o with more gas and the dryer will dry the clothes keeping the main gas valve going on and off with the correct temperature . Because your dryer shuts down so quickly you have to determine if you are getting the piolet valve on and then off or the piolet on and no main gas valve .
Safety is key and the dryer has devices to shut the gas off if things go wrong. |I am going to say you have a valve coil burnt or a safety sensor bad.
One thing to be is a hero in your home. You need to take control of your safety and your family safety. Call a repair man for this gas trouble. Stay away from trying to fix this. Yes it costs for a repair man but being a stupid person could cost you your life. Be a hero and make the call to a repair man.