def terminateServer(self):
    if self.popen:
        self.popen.terminate()
        self.popen.wait()
    if self.logfile:
        self.logfile.close()
def terminateServer(self):
    if self.popen:
        self.popen.terminate()
        self.popen.wait()
    if self.logfile:
        self.logfile.close()