writeFooter