Saving bigger documents is slower, so maybe your document is saved but not immediately. Maybe you can check if document is saved like this:
if(app.activeWindow.name.indexOf('*') != -1)alert("Document is not saved");
Yes, this alert tells me that it's not saved, but save command still get stuck. What could I do?
You might want to look at the doc.modified property instead. It reports whether the document is dirty. The saved property reports whether the document has been saved (ever).