Add a shutdown method to the ioloop thread