I was going through the website examples and also encountered the same problem. After going thru the first example at "python -m pyqtgraph.examples", the solution is to simply run pg.exec() at the end of the script. E.g.
if name == 'main': pg.exec()
Without this, the figure closes right away as you describe.