After reading comments I assume that you want to kill notepad.exe process which has opened given text file.
Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("notepad")
For Each p As Process In pProcess
If p.MainWindowTitle.Contains(filename) Then
p.Kill()
End If
Next
This code might work for you then