Defer writing to next tick to allow attaching