Improved dose_main_test_stub stop mechanism.