Add end block
Add check that no node is left open