If an add-on throws/returns an error when an attempt is made to disable it, this could halt the mass toggle add-ons process half way, having only disabled the add-ons that appear in the list before this buggy add-on.
This is made worse by refreshing the page, which causes the process to re-run using the current list of enabled add-ons, which means the original cached list of enabled add-ons is now gone.
There might also be legitimate reasons for an add-on to show a warning or throw/return an error if it is disabled. For example, it might be that an add-on stops itself from being disabled if it knows that disabling itself would cause serious errors. For example (although it doesn't actually do this), an add-on like NoForo by Waindigo (which deletes core database tables) might stop itself from being disabled.
Perhaps the mass toggle code could be included in a try/catch block and/or the XenForo_DataWriter::ERROR_SILENT error handler could be enabled.