In many apps where the UI and processing code go hand in hand (this seems to be one of them), you need to "yield" a moment of processing in the looping task to keep the UI responding to the user.
For example, say I want to "Stop" the process of fixing a file - can't do it. Button does nothing. X button does nothing, etc.. Depending on how the GUI is coded (if it were wxWidgets, which is what I usually use, wx.Yield() is all that you'd need) this may be as simple as throwing a single line in.
This is on Windows 7, by the way - no idea if the same behavior occurs on other platforms, or if the GUI is even the same code on other platforms.