Fix #939

It should not crash when you try to close the console on windows anymore
aswell.
Merge pull request #946 from dalkon/master

Fix #939