added auto-save when switching buffers