How Close or Kill Process SLDWORKS.exe c#

Staff,

Does anyone know how I explain the process of closing solidworks after finishing the execution of a program stand alone?
After finishing the program, closing the same but the process continues sldworks.exe running, I used to using System.Diagnostics in order to kill the process but for some reason did not work.
Below the code of the button to close the process.

        private void Button2_Click (object sender, EventArgs e)
        (
            Process [] processes = Process.GetProcessesByName ("SLDWORKS.exe");
            foreach (Process process in processes)
            (
                processo.CloseMainWindow ();
                processo.Kill ();
            )
            this.Close ();
        )

Regards,

Josano

SolidworksApi macros