stop running measurement when an exception is raised