I/O almost done sometimes write gets called too soon