move ->close(); to footer