Added a close method to support closing