call ph_stm_flush() as part of ph_stm_close()

you know, it might be important to actually write that data out.