Store previous state and restore it when TV is being switched off