fix a instance termination notification race

The race was between Wait() being notified of the child's death
and communicate() being notified of the same by having its pipes
closed.