or better

if 'working_dir' in fwd['info']:
    write_string(fid, FIFF.FIFF_MNE_ENV_WORKING_DIR, fwd['info']['working_dir'])