I just made a change to the script so no one else should have to modify it to do that.
Now if you run the script and there are no files needing metadata writeback, the dialog box will ask you if you want to still refresh the data driven categories. If you choose no, the script ends. If you choose yes, it refreshes the DD categories.