C# version here.
You can use the .NET Process class to close an external application. First you must create a Process object that represents the application. You can then call Kill on that Process to force the application to close. That's the only way to close applications that don't have a GUI but, for those that do, it's better to call CloseMainWindow first and only call Kill as a last resort. It's like the difference between just throwing someone out and asking them to leave first. CloseMainWindow gives the application a chance to clean up before exiting, while Kill just removes it from memory. E.g.
vb.net Code:
Private Sub CloseProcessesByName(ByVal processName As String)
For Each p As Process In Process.GetProcessesByName(processName)
'Ask nicely for the process to close.
p.CloseMainWindow()
'Wait up to 10 seconds for the process to close.
p.WaitForExit(10000)
If Not p.HasExited Then
'The process did not close itself so force it to close.
p.Kill()
End If
'Dispose the Process object, which is different to closing the running process.
p.Close()
Next
End Sub
The process name is what gets displayed in Windows Task Manager.