Run disconnect code on the main thread.