modify save-and-restore option when exit.

use quit-window when emacs version is 24+.