Ensure multi-item chunks in couch_btree:chunkify/1

If the last element of a chunk has a huge reduction it was possible to
return a btree node that had a single key. This prevents the edge case
by forcing it into the previous chunk. Without this we can end up with a
case where a path in the tree can extend for many levels with only a
single key in each node.

COUCHDB-3298
diff --git a/src/couch_btree.erl b/src/couch_btree.erl
index 8f2395c..adbc92b 100644
--- a/src/couch_btree.erl
+++ b/src/couch_btree.erl
@@ -352,6 +352,9 @@
 
 chunkify([], _ChunkThreshold, [], 0, OutputChunks) ->
     lists:reverse(OutputChunks);
+chunkify([], _ChunkThreshold, [Item], _OutListSize, [PrevChunk | RestChunks]) ->
+    NewPrevChunk = PrevChunk ++ [Item],
+    lists:reverse(RestChunks, [NewPrevChunk]);
 chunkify([], _ChunkThreshold, OutList, _OutListSize, OutputChunks) ->
     lists:reverse([lists:reverse(OutList) | OutputChunks]);
 chunkify([InElement | RestInList], ChunkThreshold, OutList, OutListSize, OutputChunks) ->