added a wait-for-close state to pindex Run()