Properly handle processes being terminated.

When a process is being terminated, all relevant data is not available
from /proc anymore, we need to be careful as to what we try to gather
from there.