When track power is removed, a TMCC or Legacy engine with a battery (or YLB) will continue making sound for about 5-10 seconds, then play the normal "shutdown" sound. There is no interaction between the battery circuit and the track.
Maybe your switch was wired in such a way that even though your transformer lever was at minus, there was still enough voltage on the track to keep the sound system running.