defing ed in close functions