What happens when the doors are locked is that the ecu's lose there power supplies. Modern cars with mutiplexing use a different style to supply there equipment or systems. Instead of having ignition feeds, the body Ecu controls this. I haven't looked at all the wiring diagrams to be a 100% accurate with the toyota system but I can paint a picture of what generally happens.
Like mentioned, the body Ecu controls the supplies to the equipment, a car is more like a computer these days, and the ecu's are part of this computer system and communicate with each other with 0's and 1's, and like a computer they can't just be unplugged, this is why you shouldn't just disconnect a battery, not until the system is ready.
So instead of being switched off with a lose of the power supply instantly when the key is removed, they go into standby like a Television. It then sits there waiting for you to give it instruction. Getting out of the vehicle, shutting the door and locking it, tells the vehicle you have gone and to shut down and not just be in standby, so it then shuts the systems down and removes the power supplies to the equipment. It then sits there waiting to be unlocked to wake the systems back up ready for you to use. They do this as like a computer it takes a bit of time to start up, so it gets a head start by turning everything into standby before you put the key in the ignition.
There is normally a time out, as if nothing has been touched in 15mins, the vehicle will shut down as it presumes your gone even without locking it, if it senses your there by you turning the radio on or operating anything then it won't shut down. This is where your issues seems to be, it is seeing something in this timed period that stops it shutting down.
Getting out and shutting the door and locking it shuts the vehicle down without a delay, but again this process can take 2 minutes or upto 10 minutes if you have factory Sat Nav.
Your radio is a ecu, Instrument panel is, most equipment is a ecu as it communicates on the multiplex network sharing information.
Like mentioned, the body Ecu controls the supplies to the equipment, a car is more like a computer these days, and the ecu's are part of this computer system and communicate with each other with 0's and 1's, and like a computer they can't just be unplugged, this is why you shouldn't just disconnect a battery, not until the system is ready.
So instead of being switched off with a lose of the power supply instantly when the key is removed, they go into standby like a Television. It then sits there waiting for you to give it instruction. Getting out of the vehicle, shutting the door and locking it, tells the vehicle you have gone and to shut down and not just be in standby, so it then shuts the systems down and removes the power supplies to the equipment. It then sits there waiting to be unlocked to wake the systems back up ready for you to use. They do this as like a computer it takes a bit of time to start up, so it gets a head start by turning everything into standby before you put the key in the ignition.
There is normally a time out, as if nothing has been touched in 15mins, the vehicle will shut down as it presumes your gone even without locking it, if it senses your there by you turning the radio on or operating anything then it won't shut down. This is where your issues seems to be, it is seeing something in this timed period that stops it shutting down.
Getting out and shutting the door and locking it shuts the vehicle down without a delay, but again this process can take 2 minutes or upto 10 minutes if you have factory Sat Nav.
Your radio is a ecu, Instrument panel is, most equipment is a ecu as it communicates on the multiplex network sharing information.