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