diskio refactoring with atexit