Update close semantics
Add cap and len functions