Seems the autocmd is not the perfect choice and will not always save when leaving insert mode. Adding the save on the <esc> command seems to work better.