adding signal handler to print the stats