So on my friend's realm, I went through my nether portal and got blown up by a creeper into lava and closed Minecraft but I still saw myself on another account connected to it and it sayed I died while Minecraft wasn't open. My netherite sword and pic and full armor didn't float to the top... I don't think any of it dropped.
Linked issues
duplicates 1
Comments 2
Having your items despawn 5 minutes after you die is an intended feature of the game's design. You can hedge against losing your items in a single-player world by saving and quitting, but that's not intentional, it's just forced because refusing to let you quit, or despawning your items early because you quit, would just be rude and annoying.
Although the issue described here is different from the one described in MCPE-92017, they both have the same cause, so I am resolving this as a Duplicate of MCPE-92017, which was resolved as "Works As Intended".
The realms server does not immediately stop when you are disconnected or log off, even if you are the last player. This is a side-effect of the way realms are designed so that if someone is disconnected unintentionally the server will still have the world loaded if they reconnect. So the chunks may have remained loaded long enough for the despawn timer to expire. To avoid this it's a good idea to make sure you are in a reasonably safe location when logging off.