As token accounts can only be closed when the non-SOL token balance is 0 I'd like to add a prior instruction to transfer all remaining tokens to a certain account. The problem I am facing is that a prior instruction transfers x tokens to the to-be-closed account. Therefore I am not aware of the token balance when creating the instruction and cannot add a SPL transfer ix as the amount is unknown to me.
Checked the spl token program instruction set.