refactor to close order