Explicitly set t.connection to nil when the connection fails

Resolves #706.