For Linux this should clear them for all devices in one go if your issue is just .lock files
find $HOME/.android -type f -name '*.lock' -exec rm {} \;
Example with it just echoing out.
❯ find $HOME/.android -type f -name '*.lock' -exec echo rm {} \;
rm /home/mike/.android/build-cache.lock
rm /home/mike/.android/debug.keystore.lock
rm /home/mike/.android/avd/Pixel_6_Pro_API_33.avd/multiinstance.lock
rm /home/mike/.android/avd/Pixel_6_Pro_API_33.avd/hardware-qemu.ini.lock
rm /home/mike/.android/avd/Pixel_6_Pro_API_30.avd/multiinstance.lock
rm /home/mike/.android/avd/Pixel_6_Pro_API_30.avd/hardware-qemu.ini.lock
rm /home/mike/.android/build-cache/3.5.2.lock
~ at 10:16:27
❯
If you did not stop them all first can run this first beforehand.
adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done