Replace all instances of close with destroy