I believe they shut off 30 seconds after the last door is closed. In other words they won't go off until one or more doors are opened, and then they are all closed again.
The lights can be turned off immediately if the lock button on the keyfob is pushed twice.
This only works if the headlights were already on when you turned off the ignition. If you turn off the ignition and then turn on the lights, they will never go off automatically, although they will automatically start dimming after a few hours.