* Adding a close method for graceful shutdown

@ronkorving could you have a quick look? I will test it further with some of our tools in the next few hours.
Maybe that's okay anyway... but then you should not emit if I did provide a callback.