Set $this->db=null on errors in connect