When draining previous queue don't trip task.
- Only create a new tcs if necessary
- Added unit tests.

#1835
Never transition from Closed to another state.
- Make sure the closed state is terminal
- Added unit tests.
Catch errors thrown in the OnError handler.

#1836
Fixed sql recovery logic.
- Get rid of clear failed and set failed since it was
  causing deadlocks.

#1831
Fixed issues with dupes in ScaleoutStore.
- If second binary search fails bail out.

#1831
Minimize missing of messages when there's gaps in the ids in scaleout
- When binary search fails, return the last valid search range
  so that we can pick the smallest value bigger than the target id.
- Added unit tests for new behavior.

#1831
Merge branch 'release' into dev