When putting a line profile, the pgm is still running once the figure is closed. I will try to fix it using a closing event.