Register clean up function with ::atexit() so that monitor will be cleaned upon ::exit().