I ran across the same issue reported in:
http://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg17687.html
The initial question was why mri_segstats did not work and complained:
"Error: could not open stats/aseg/stats for writing"
If you try to, literally, copy and paste the same command listed in the aseg.stats file:
mri_segstats --seg mri/aseg.mgz --sum stats/aseg.stats --pv mri/norm.mgz --ctab-default --excludeid 0 --brain-vol-from-seg --brainmask mri/brainmask.mgz --in mri/norm.mgz --inintensity-name norm--in-intensity-units MR --etiv --subject 004
you'll get the error message, even if you source the freesurfer setup file (/usr/freesurfer/SetUpFreeSurfer.csh). In order to run the command, one needs to type out the complete path to each referenced file:
mri_segstats --seg ${SUBJECTS_DIR}/'subject"/mri/aseg.mgz --sum ${SUBJECTS_DIR}/'subject"/stats/aseg.stats --pv ${SUBJECTS_DIR}/'subject"/mri/norm.mgz --ctab-default --excludeid 0 --brain-vol-from-seg --brainmask ${SUBJECTS_DIR}/'subject"/mri/brainmask.mgz --in ${SUBJECTS_DIR}/'subject"/mri/norm.mgz --inintensity-name norm--in-intensity-units MR --etiv --subject 004
(obviously replace ${SUBJECTS_DIR}/'subject" with the correct path and subject ID).
I apologize for the lengthy response but I felt the referenced thread ended without truly addressing the problem. Also, when running into the exact same error I was left scratching my head trying to figure it out. Hopefully someone else finds this useful.