Enable AFK mode without keeping your computer on. Use /offline to spawn a copy of your player. If your offline player dies, you'll die but still have time to retrieve your stuff. If the offline player survives, you'll inherit its gains upon return.