Heat removal and recovery in biomass pyrolysis