Updated stty session state save to check for an interactive terminal

This prevents stty throwing errors (like 'stty: standard input: Invalid argument') in the output when run in a non-interactive session (like via Jenkins).