iolog: fix use-after-free of iolog_flush_data