Added a close method.