print stats only at end of execution