Properly end application when Ctrl+D is pressed.