Add gzip compression when writing files ending with .nii.gz