prepare for closure