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

# 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).

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](https://docs.xbox.com/build/core-features/common/game-save/game-saves-tools.md)
* [XGameSave API overview](https://docs.xbox.com/build/core-features/common/game-save/xgamesave.md)
* [Time-sensitive threads](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## See also

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


## Related topics

- [Game Saves tools](https://docs.xbox.com/build/core-features/common/game-save/game-saves-tools.md)
- [XGameSave API overview](https://docs.xbox.com/build/core-features/common/game-save/xgamesave.md)
- [XGameSave (API contents)](https://docs.xbox.com/reference/system/xgamesave/xgamesave_members.md)
- [XGameSaveInitializeProvider](https://docs.xbox.com/reference/system/xgamesave/functions/xgamesaveinitializeprovider.md)
- [XGameSaveCloseContainer](https://docs.xbox.com/reference/system/xgamesave/functions/xgamesaveclosecontainer.md)
