Free stdin on exit
Merge pull request #19869 from sfackler/free-stdin

Free stdin on exit

Reviewed-by: aturon