Differentiable Quantum Programming with Unbounded Loops