Handle race condition in save and autosave buttons