The problem is pretty obvious if you think about it.
1. If the bank booth is not null, you interact with it.
2. After interacting with it, you immediately try to withdraw from it, in the case that the bank is open.
The bank however is in many cases not going to be open after 500 milliseconds after clicking, especially if there's distance between you and the object (which there will often be, since 'closest' method doesn't use manhattan distance).
3. In the case that the bank was not open after the 500 milliseconds, you try to interact with the bank booth again, but since you cannot interact with object while the bank widget is open, the interact method will close the bank before interacting.
^this repeats.
You should generally avoid doing multiple interactions in 1 loop cycle, and always evaluate the success of your actions (never assume success).
In this particular case tho, I think you can solve it by adding a check to the case for opening the bank
if (bankbooth != null && !getBank().isOpen() && !myPlayer().isMoving()) {
//interact
}