adds close method to init