Either I'm doing something wrong or your script is not banking the dragonleather (tan hide spell ofc).
I found what causes the bug. If you have 26 spots in your inventory for dragonhides, and you only tan 25 (as you should) it doesn't bank. So the trick is too use up 3 inventory spots with no hides (astral runes, nature runes and fire runes).
After this, it is working fluently.