close inotify_fd when it is no longer needed