socket.write return nil when write to a closed fd