Use atexit function to reset stdin