adds close method and disconnect event to address #6