Found a better way to autowrite when leaving insert mode