Added a function to shutdown the daemons after a specific test
is done. Fix bugs.