[3.5.x] Backport of https://github.com/cfengine/core/pull/1036

* Fix cf-serverd stat()'ing the file tree every second.
* Don't close file descriptors we don't own.