Switch mode when saving file