Fix two issues during client restore state
Fix two issues during client restore state

This PR fixes two issues:

1) A close of a nil stopCollection channel when restoring and prestart
fails. The failure will cause the killCh to be triggered which will
close collection before it has been initialized.

2) Fixes a deadlock in which the handleWaitCh is never triggered since
it is not initialized when there is an error in prestart and the killCh
is triggered.

Both fixes are by maintaining the loop invariant that the two channels
are valid after there is a handle.

hashicorp/nomad,diptanu/nomad,hooklift/nomad,kmalec/nomad,diptanu/nomad,diptanu/nomad,barnardb/nomad,kmalec/nomad,nak3/nomad,Ashald/nomad,achanda/nomad,hooklift/nomad,hashicorp/nomad,frundh/nomad,hooklift/nomad,novilabs/nomad,Ashald/nomad,dvusboy/nomad,Ashald/nomad,hashicorp/nomad,nak3/nomad,diptanu/nomad,hooklift/nomad,achanda/nomad,burdandrei/nomad,nak3/nomad,novilabs/nomad,barnardb/nomad,nak3/nomad,hooklift/nomad,barnardb/nomad,achanda/nomad,nak3/nomad,frundh/nomad,dvusboy/nomad,novilabs/nomad,kmalec/nomad,hooklift/nomad,novilabs/nomad,dvusboy/nomad,burdandrei/nomad,hashicorp/nomad,frundh/nomad,novilabs/nomad,burdandrei/nomad,burdandrei/nomad,Ashald/nomad,kmalec/nomad,dvusboy/nomad,diptanu/nomad,hooklift/nomad,achanda/nomad,nak3/nomad,barnardb/nomad,kmalec/nomad,achanda/nomad,frundh/nomad,dvusboy/nomad,Ashald/nomad,kmalec/nomad,kmalec/nomad,hashicorp/nomad,Ashald/nomad,dvusboy/nomad,achanda/nomad,diptanu/nomad,barnardb/nomad,novilabs/nomad,frundh/nomad,nak3/nomad,burdandrei/nomad,burdandrei/nomad,achanda/nomad,diptanu/nomad,dvusboy/nomad,hashicorp/nomad,barnardb/nomad,frundh/nomad,frundh/nomad,burdandrei/nomad,Ashald/nomad,novilabs/nomad,barnardb/nomad