Power Off Delay circuit
A RC circuit with long time constant + buffer with Schmitt trigger + relay will probably do the job. When you flip the lamp switch a capacitor is charged. When you flip it back, the capacitor will start to discharge slowly. When its voltage reaches certain voltage lamp is turned off.