added shutdown call to stop the daemon
file descriptor must be closed after a child exit
use shutdown, not close