Fix test raciness

Running the tests with -race indicated a race condition in the mockbroker around
reading/writing b.expecting. Get rid of that value entirely and just use the len
of the channel, which is simpler and less racy.

With that fixed, also fix the hang revealed in TestProducerFailureRetry due to a
mis-ordering and deferal of Close calls. We'd been getting away with it only
because of the race in the mockbroker.

Once this is merged we can do another PR to have CI run with -race.
Merge pull request #189 from Shopify/fix-mockbroker-race

Fix test raciness