Remove kill-buffer-hook if the major mode is changed.