When the roof stops retracting, leaving it about 1" from the latch, is the retract button flashing red? And does the roof motor stop? If so, that means the roof is bunching up and not folding properly. The outside corners of the canvas should be pointing out, not in. This is a common problem with this generation of Z4s. Mine does the exact same thing.
The fix, according to BMW, is to retract the roof about half way, then make sure the corners are not folding in. If they are, pull them, then retract the rest of the way. Then, you're supposed to leave the top down for at least 48 hours to "retrain" the roof fold. I tried this and it kind of worked, but it didn't stick. I've later determined that my roof is shot because glue is seeping from the inside to the exterior of the roof. If you see some sticky spots on your roof (not drops, but rectangular sections), it's the glue that attaches parts of the roof to the assembly and it's seeping through.
I'm resigned to replacing my roof at this point...
For you, though, try making sure those corners don't fold inward. See if that makes it go down the rest of the way. When I was experimenting with that, I had to do it several times, but then it started to work and actually latch. Otherwise, I had to push it down with my hand to get it to latch.