Added a test for cases where a kernel shuts down due to exit() being called.
KernelConnection.close ensures that the connection is open before attempting to close.