Call io_teardown after the while loop