move close out of loop