fix terminal size detection in mintty

use try catch and open from t.out_stream
Merge pull request #7620 from JuliaLang/tk/mintty-size

fix terminal size detection in mintty