Via mouse - right click the cmd icon and select Close Window
Via keyboard - press WindowsKey+T, navigate to the cmd icon (use up arrow), press Menu key, select Close Window
Install 7+ Taskbar Tweaker and configure Middle Click to Close Window.
FWIW I hide them (haven't figured a way to have them show in the tray), if I need to kill one or more of them I use Task Manager (it shows port number and library path).
Moderator Notice
@phossler - why in Dev forum? I moved it
BR