Thermal treatment of lignin, cellulose and hemicellulose in nitrogen and carbon dioxide