re-try write if socket was closed