Fix potential panic in conn.Close