This section performs the actual freelist write. It frees the original freelist first to make sure that we have an upper bound for how large the written freelist can be. It then allocates enough pages for that which will shrink the freelist.