node.go: fix defer and add doc