> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XGameSaveCloseProvider

> XGameSaveCloseProvider

# XGameSaveCloseProvider

Releases resources held by the XGameSaveProvider.

## Syntax

```cpp theme={null}
void XGameSaveCloseProvider(  
         XGameSaveProviderHandle provider  
)  
```

### Parameters

*provider*   \_In\_\
Type: XGameSaveProviderHandle

XGameSaveProvider handle to be closed.

### Return value

Type: void

## Remarks

<Note>This function isn't safe to call on a time-sensitive thread. For more information, see [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

Each provider holds on to resources that need to be cleaned up when no longer needed or when the existing provider has become invalid. A provider can become invalid for a few reasons with the primary one being that the while the application was suspended the context was stolen on a different device by the same user. This is represented as **E\_GS\_HANDLE\_EXPIRED** and can be returned from any of the XGameSave APIs, the proper handling is to close the provider and then re-initialize and have the user prompted to deal with any possible conflict issues.

```cpp theme={null}
XGameSaveProviderHandle _provider; 
 
void Sample::_Uninitialize() 
{ 
    if (_provider) 
    { 
        XGameSaveCloseProvider(_provider); 
        _provider = nullptr; 
    } 
} 
```

## Requirements

**Header:** XGameSave.h

**Library:** xgameruntime.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## Conceptual documentation

* [Game Saves tools](/build/core-features/common/game-save/game-saves-tools)
* [XGameSave API overview](/build/core-features/common/game-save/xgamesave)
* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

[XGameSave](/reference/system/xgamesave/xgamesave_members)\
[XGameSaveInitializeProvider](/reference/system/xgamesave/functions/xgamesaveinitializeprovider)\
[XGameSaveInitializeProviderAsync](/reference/system/xgamesave/functions/xgamesaveinitializeproviderasync)\
[Debugging Game Saves](/build/core-features/common/game-save/game-saves-debugging)


## Related topics

- [Game Saves tools](/build/core-features/common/game-save/game-saves-tools.md)
- [XGameSave API overview](/build/core-features/common/game-save/xgamesave.md)
- [XGameSave](/reference/system/xgamesave/xgamesave_members.md)
- [XGameSave Provider Save method reference](/reference/system/Wrappers/classes/provider/methods/xgamesave_wrapper_provider_save.md)
- [XGameSaveInitializeProvider](/reference/system/xgamesave/functions/xgamesaveinitializeprovider.md)
