title: Why does defer stmnt.Close() seem to block my http.Redirect?
body: <p>Why does my <code>defer stmnt.Close()</code> seem to block my <code>http.Redirect</code> from redirecting it just hangs on the website infinitely trying to load.</p>
  
  <p>But if I remove the <code>defer stmnt.Close()</code> it redirects just fine?</p>
  
  <pre><code>    err = db.QueryRow("SELECT steamid FROM accounts WHERE steamid = ?", ids).Scan(&amp;steamid)
      if err != nil {
          common.WriteLog(err.Error(), r)
          http.Error(w, "Failed to connect to database. Try again in a bit.", 500)
      }
  
      switch {
      case len(profile.Response.Players) == 0:
          common.WriteLog("Failed to look you up in the steam database. Try again in a bit.", r)
          http.Error(w, "Failed to look you up in the steam database. Try again in a bit.", 500)
      case err == sql.ErrNoRows:
          stmnt, err := db.Query("INSERT INTO accounts SET steamid=?", ids)
          if err != nil {
              common.WriteLog(err.Error(), r)
              http.Error(w, "Failed to insert your account to the database. Try again in a bit.", 500)
          }
          defer stmnt.Close() // &lt;&lt;&lt;&lt;&lt; The suspect
          // Insert Account
  
          http.Redirect(w, r, "/", 303)
      case err != nil:
          common.WriteLog(err.Error(), r)
          http.Error(w, "Failed to insert your account to the database. Try again in a bit.", 500)
  
      default:
          // Login User
  
          http.Redirect(w, r, "/", 303)
  
      }
  </code></pre>