Praise be to Allah.
I put this question to our shaykh, ‘Abd ar-Rahmaan al-Barraak (may Allah preserve him) and he said:
There is nothing wrong with that, and this does not come under the heading of fidgeting that is prohibited, because it is done for a need, and not by way of messing about. End quote.
And Allah knows best.