Saving PlayerData when Client Closes - Dedicated Server

Hi Guys,
Is there any possibility to save Character Data when a Player leaves?

My Setup:

  • Dedicated Server has a Postgresql Connection
  • PlayerState handles the Save / Load Functions for saving & recieving PlayerData
  • in OnEndPlay in PlayerState i wanted to save the Replicated Data from Pawn

The Problem:
In PIE it saves right but if Client gets closed in non Editor Windows, Server says, Pawn is allready marked for Destruction, so all my Values are 0 then

Am i doing something wrong?
Or is there any way of first save and then clean up on server?

Kind Regards,