Small bugfix, avoid potential infinite loop for inotify and other clean-ups.