Add doc comments.
Change task qeueue drain to wait for the final task to complete and then reset.
Add method for closing the connnection.