Add option for max open shards

Fix for #286