A closed-loop biorefining system to convert organic residues into fuels