This was causing a kernel panic when closing the terminal by directly exiting the shell (either EOF or the exit command)