Fix TransferManager's lifetime management This patch introduces a builder function to instantiate TransferManager as a shared_ptr. That ensures that other threads can increase TransferManager's lifetime until all the callbacks have finished.