Add child exit handling

Targets #629.