title: Closing a window of a app one window at a time instead of task killing them all using python
body: <p>I am working on some freelance for a client who works at a VR place. They have this bug where the Oculus Mirror app opens over and over until it overloads the computer. I want to be able to close all extra instances of Mirror but one. Right now my code will detect if more than one window is running, close Oculus Mirror windows. The problem is it closes all of them and I want to have one window left. I have tried loops but I can't seem to get that to work either. Any ideas or other ways to close an app other than os.system(&quot;TASKKILL /F /IM OculusMirror.exe&quot;)?</p>
  <pre><code>import wmi
  import os
  import time 
  
  f = wmi.WMI()
  
  running_windows = 0
  
  for process in f.Win32_Process():
    if &quot;OculusMirror.exe&quot; == process.Name:
      running_windows += 1
  
  if running_windows &gt; 1:
     os.system(&quot;TASKKILL /F /IM OculusMirror.exe&quot;)
     print('Closed extra OculusMirror.exe windows')
  elif running_windows == 1:
     print('Only one OculusMirror.exe window is open')
  else:
     print('OculusMirror.exe is not open')
  </code></pre>