I have a C# code for a simple windows form with 3 buttons. Button 1 calls R and plots a surface while button 2 plots a contour. If I launch the application and click on button 1, I correctly see the surface plot but then I would like to click on button 2 to open a new window with the counter plot. Unfortunately, if I try to do so the app freezes and I cannot go on. So I have added button 3 with the intention to close the R engine if it is running. The idea was to kill the R instance and reopen it when clicking on button 2. But this doesn't work either. Is there a way to fix my problem? I have a C# code for a simple windows form with