Also add a sleep after printing so that the io server has written all output before exiting. It's a work around.