I think the flag stays on the casket until just before burial, and is then given to Mrs Reagan. Someone check me on that.
Yes, right before the casket is lowered into the ground the flag is removed, properly folded and presented to the spouse.