Fixed memory leak with object I/O streams not being closed