I am trying to build a small shell application, which runs a command from a GUI application. When I press the "off" button, the console for the command should be closed. I have two questions:

1. When I run the command, the command is running on the same console as my Python script. How can I open the command in a new console?
2. How can I stop the command? I mean like if the command is working in the same process as the GUI, I can just use `exit()`, but then the entire program will be terminated.

This is my code so far:

```
from tkinter import *
import subprocess
import os

top = Tk()

def turnOn():
    p = subprocess.Popen("ping stackoverflow.com")

def turnOff():
    pass
    #should i do: p.close() of something?

on = Button(top, text = "on", command = turnOn)
off = Button(top, text = "off", command = turnOff)

on.grid()
off.grid()
top.mainloop()

```