Attempt to fix the double mio_close problem