free resource before quit