rework _close
final comments, documentation, fixes and refinements.