Automatically save on closing.