% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hdf5CloseAll.R
\name{hdf5_close_all}
\alias{hdf5_close_all}
\title{Close all HDF5Matrix objects}
\usage{
hdf5_close_all(envir = .GlobalEnv, verbose = TRUE)
}
\arguments{
\item{envir}{Environment to search (default: .GlobalEnv)}

\item{verbose}{Show details (default: TRUE)}
}
\value{
Invisible vector of closed filenames
}
\description{
Finds and closes all HDF5Matrix objects in the specified environment.
}
\details{
This function:
\itemize{
\item Searches for HDF5Matrix objects in the environment
\item Calls \code{$close()} on each valid object
\item Forces garbage collection
\item Reports closed files
}

\strong{Note:} Only finds objects in the specified environment.
Objects inside functions or other environments are not affected.
}
\examples{
\donttest{
tmp1 <- tempfile(fileext = ".h5")
tmp2 <- tempfile(fileext = ".h5")

X  <- hdf5_create_matrix(tmp1, "data/A", data = matrix(rnorm(100), 10, 10))
Y  <- hdf5_create_matrix(tmp2, "data/B", data = matrix(rnorm(100), 10, 10))

X <- hdf5_matrix(tmp1, "data/A")
Y <- hdf5_matrix(tmp2, "data/B")

# Both open
X$is_valid()  # TRUE
Y$is_valid()  # TRUE

# Close all at once
hdf5_close_all()

# Both closed
X$is_valid()  # FALSE
Y$is_valid()  # FALSE

# Cleanup
unlink(c(tmp1, tmp2))
}

}
