* 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.
There's no test here to see if cb was passed.
I think it's safe and sort-of the standard way of doing things to throw the error if there is no cb.