When you exit from a shell-mode process, the zombie buffer is still there. It dose not make any sense. So this function will have that buffer to be killed after exit.