Fixed the double-free error in the IO library.