format footer and fix close