It looks like the flow of execution when running wpst is broken because of run_main using exit 0 and exit 1. It never returns, and therefore things like printing statistics never happen.
run_main should return and the exit status should be handled at the very end of the wpst function.