This moves workspace unpacking to a helper function to leverage a defer, which ensures the file is always closed.