If you want to check if Excel has already opened files, you have to get an instance of Excel application then loop though the collection of workbooks.
BTW: you need to learn how to use namespace aliases. See:
using directive - C# Reference | Microsoft Docs[
^]
using ExcelNs = Microsoft.Office.Interop.Excel;
ExcelNs.Application oExcelApp = (ExcelNs.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
foreach(ExcelNs.Workbook wbk in oExcelApp.Workbooks)
{
if(wbk.Name="nameToFind")
{
wbk.Close(SaveChanges=false);
}
}
For further details, please see:
Launching Office Apps Programmatically – Andrew Whitechapel[
^]