'C# : Killing a specific file opened and not all instance

I'm trying to open an excel file in my application via Process. When the form is closed I want to close that file automatically . The issue that I'm facing is even if I specify the PID process of the Excel opened . When I run the kill instruction, all the other excels file opened will close and not specifically the one that I need.

Could you please help me .

 File.WriteAllBytes(filePath, bytes);
 proc = new Process();
 proc = Process.Start(filePath);
 processId = proc.Id; //keep PID to kill that process 

  proc.WaitForInputIdle(); //Set focus on opened file
  SetForegroundWindow(this.Handle);                        
  proc.Dispose();
// killing the process after file use
  Process processes = Process.GetProcessById(processId);
  processes.Kill();


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source