I don't have AutoCAD here.
I see you use the COMMAND function to draw the boxes, so you could use the CMDACTIVE sysvar to pause the code. After the COMMANND "BOX"... I would include a loop to be repeated until the mentioned sysvar becomes nil.
This is the answer to your question to make lisp to wait AutoCAD. But firstly I would run again the code but with OSNAP turned off. Well, just my try.