close before delete