Fix temporary file lifetime.