Fill in the header using the statistics
Write block index and header at appropriate places