I am running my C# application which opens many excel files using loops but then in the end of each loop I call the below function to end the excel process but still the process in task manager is not ended and I am not sure why. Can anyone advise?
private void xlCleanup(Excel.Application xlApp, Excel.Workbook xlWorkbook, Excel.Worksheet xlWorksheet, Excel.Range xlRange)
    {
        //cleanup
        GC.Collect();
        GC.WaitForPendingFinalizers();
        //rule of thumb for releasing com objects:
        //  never use two dots, all COM objects must be referenced and released individually
        //  ex: [somthing].[something].[something] is bad
        //release com objects to fully kill excel process from running in the background
        if (xlRange != null || xlWorksheet != null)
        {
            Marshal.ReleaseComObject(xlRange);
            Marshal.ReleaseComObject(xlWorksheet);
        }
        //close and release
        
        xlWorkbook.Close(0);
        Marshal.ReleaseComObject(xlWorkbook);
        //quit and release
        xlApp.Quit();
        Marshal.ReleaseComObject(xlApp);
    }
 
    