Pyqt Terminal hangs after excuting close window command
<p>I have read lots of threads online, but still I could not find the solution. My question should be very simple: how to close a Pyqt window WITHOUT clicking a button or using a timer.
The code I tried is pasted below</p>

<pre><code>from PyQt4 import QtGui, QtCore
import numpy as np
import progressMeter_simple
import sys
import time
import pdb
class ProgressMeter(progressMeter_simple.Ui_Dialog, QtGui.QDialog):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        progressMeter_simple.Ui_Dialog.__init__(self)
        self.setupUi(self)
        self.progressBar.setRange(0, 0)
        QtGui.QApplication.processEvents()
    def termination(self):
        time.sleep(5)
        self.close()
if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    Dialog = ProgressMeter()
    Dialog.show()
    Dialog.termination()
    sys.exit(app.exec_())
</code></pre>

<p>My Pyqt GUI is designed using Qt designer, and it is nothing but a progress bar that keeps moving from left to right (busy indication).</p>

<p>However, when I run the code above, the terminal still hangs after the Pyqt window is closed. Ctrl+C also couldn't kill the process. 
In short, how can I properly close/terminate a Pyqt window without clicking a button or using a timer?</p>