distributed::stop() passes the pointer to the instance being destroyed
by reference, in an attempt to keep things clean (by nulling the pointer
after deleting it). This is illegal, however, since the lambda is moved
in the bowels of submit_to(). In release mode this is optimized away so
the code works, but in debug mode it leads to a crash.
Fix by capturing by value instead (could also have been fixed by switching
the enclosing capture to a reference).
Credit to Gleb for identifying the problem.