MB-11194 correct order of serializing checks in taskqueue

If the tryNewTask check was done first and the checkOutShard() check
done later, then a accounting mismatch happens in the number of
curWorkers for a particular taskType since the tryNewTask has incremented
the number of curWorkers already. Writer tasks are affected by this and
this resulted in unnecessarily blocking flusher tasks causing slow disk
persistence.

Reverse the order of checks to correct the situation above.

Change-Id: If566f6025aec5ccc25b1f06db6338f12eba4a108
Reviewed-on: http://review.couchbase.org/37528
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>