Check for null on the graph before calling close.
Add todo inline comment.