Refactor Daemon to keep open files.