Check the class of the stdout and make sure it's a pipe before setting to nil