It will close automatically when there are no more commands to be executed. To explicitly kill it, import sys sys.exit(0) Luke