on RPi4+TV hat+LibreELEC-RPi4.arm-9.1.502+Kodi 18.4 (Linux Kernel 4.19.x)
i have non-english language and so all the paths and options mentioned there are just free translation, it may be named differently.
In Settings / System / Input / peripherals / CEC adapter (libCEC 4.0.4 firmware1)
there is an option to sleep/hibernate/pause playback/stop playback when i turn off the TV (HDMI-CEC enabled in it).
BUT only option of that four that works is to "stop playback". I tried to restart RPi each time.
How i know it does not work? Because i have headphones connected to the jack and only option it stop audio is when "stop playback" action is selected. Please let me know and if you need more details.