refactor close ddl