Fixes issue #32 : if connection is already closed, do nothing

Fixed issue #32 by checking connection is already closed.
If so, just return.