code: func safeClose(obj interface{}) error {
  	defer func() {
  		if r := recover(); r != nil {
  			logrus.DefaultLogger().Error("Recovered in safeclose: ", r)
  		}
  	}()
  
  	// closerWithoutErr is similar interface to io.Closer, but Close() does not return error
  	type closerWithoutErr interface {
  		Close()
  	}
  
  	if val := reflect.ValueOf(obj); val.IsValid() && !val.IsNil() {
  		if closer, ok := obj.(*io.Closer); ok {
  			if closer != nil {
  				return (*closer).Close()
  			}
  		} else if closer, ok := obj.(io.Closer); ok {
  			if closer != nil {
  				return closer.Close()
  			}
  		} else if closer, ok := obj.(*closerWithoutErr); ok {
  			if closer != nil {
  				(*closer).Close()
  			}
  		} else if closer, ok := obj.(closerWithoutErr); ok {
  			if closer != nil {
  				closer.Close()
  			}
  		} else if reflect.TypeOf(obj).Kind() == reflect.Chan {
  			val.Close()
  		}
  
  	}
  
  	return nil
  }
docs: // safeClose closes closable object.