try to shutdown more safely so callbacks, etc don't try and use the read/write channels after they are closed
Merge pull request #21 from darkliquid/safe-disconnect

Deal with shutdowns more safely