Minor bug fixed (closed file pointers)