pgm 17.1 - update client code
put the teardown in the right place. Thank you Valgrind!