forgot fclose(hdr.FILE.FID) in the eegDataset constructor after calling the sread function