code: func (s *SQLStore) Close() error {
  	s.Lock()
  	if s.closed {
  		s.Unlock()
  		return nil
  	}
  	s.closed = true
  	// This will cause MsgStore's and SubStore's to be closed.
  	err := s.close()
  	db := s.db
  	wg := &s.wg
  	// Signal background go-routines to quit
  	if s.doneCh != nil {
  		close(s.doneCh)
  	}
  	s.Unlock()
  
  	// Wait for go routine(s) to finish
  	wg.Wait()
  
  	s.Lock()
  	for _, ps := range s.preparedStmts {
  		if lerr := ps.Close(); lerr != nil && err == nil {
  			err = lerr
  		}
  	}
  	if db != nil {
  		if s.dbLock != nil {
  			s.releaseDBLockIfOwner()
  		}
  		if lerr := db.Close(); lerr != nil && err == nil {
  			err = lerr
  		}
  	}
  	s.Unlock()
  	return err
  }
docs: // Close implements the Store interface