This fixes a problem where if multiple levels of trees needed to be created in a
single request (as when clicking on a file in a commit view), only the first
level of tree would get computed, leading to 404s for a few requests. Now we
flush the trees to disk as they're computed.