While this is certainly something you never want to have to worry about, it is something that you should probably have a plan for. Unfortunately, tragedy can strike anyone at any time and although you have a lower chance of having to deal with this if you rent to a younger person or family, you never really know what is going to happen. This is why we always suggest that you have a plan put in place for what will happen if you are renting to someone who passes away.
When I was a teenager, my grandfather passed away. My mother and I were staying with him at the time, as he needed 24/7 care. He lived in a house trailer on rented land which he paid twice a year, in April and in October. When he passed, it was January and so his rent was paid up through April. The man in charge of the land told us on the day he passed away that we had less than a week to get out of the trailer with everything as we were not on the lease and this was his policy. While not every landlord will have this view, each person should have some idea of what they will do if a situation like this were to occur.
Letting a family member stay in the apartment through to the end of the lease to sort out your tenants affairs may open you up to issues if something were to happen to them, however if you have ever tried to take care of the estate of someone who has passed you know how difficult this task is. This is why it is important to form your own view and plan, as each person has a different situation. If you are alerted to a situation where an elderly or severely injured person is being taken care of, then you should always go over the policy with their caretaker so that they are not taken by surprise while still grieving.
Although death is always an upsetting thing to think about, as a landlord you never know what is going to happen. Even if only one of your tenants passes in a multiple named lease, you should have an idea of what you will do. Sometimes there are good reasons to let a lease break.