Can you explain why you want to use Qleader, and not just Leader?
Because Qleader is not an Autocad object. Qleader is a command that creates a leader, and separately creates a Mtext.
Unlike Mleaser which is 1 object. The MText is actually integrated with the leader in a Mleader.
Anyway, ran your code; and the leaders are associated to the object as long as I SNAP to a point (endpoint, midpoint....) of that object.
Except that I commented out (temp-osmode-off) and (temp-osmode-reset) which you didn't post here. Just a guess... (temp-osmode-off) is the function that causes the problem. The function name sounds like it turns off OSNAP; just the thing that allows the association
Try removing those 2 function calls.