Revert "Revert "Exit the program if a getch() call fails.""

This reverts commit 0823e2b690cfdd2a86b5ef93aef894a4f027ed19.
Only quit if stdin is gone.