Use a RAII guard to ensure running flag is unset when a monitor stops for any reason.