More reliable close refactor.