0.1.5.2:close: rewrite function for closing regions