I have multiple virtual devices, some of them can\'t be deleted.
Error message is
The android virtual device XXX is currently running in an e
An alternative and much simpler solution that works from the AVD manager.
From the AVD manager click the New button. Set the name as the name of the device that you can't close, choose any settings, and tick the box that says Override the existing AVD with the same name.
This will kill the old one and overwrite with the new one. The new one isn't running and so can be deleted.