Add close method, add an example