If you call SendMessage in AHK to perform the save in UR, that will not return until the save has completed, so a wait shouldn't be necessary.
SendMessage(WM_COMMAND, ID_FILE_SAVE)
WM_COMMAND = 0x0111 (273 decimal)
ID_FILE_SAVE = 0xE103 (57603 decimal)
https://ahk4.us/docs/commands/PostMessage.htm
I will consider what could be done about making the search mode dynamic.