Only set StdInputHandle, StdOutputHandle and StdErrorHandle once

git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@29094 3ad0048d-3df7-0310-abae-a5850022a9f2
 Call Errno2noutres if system call to close the handle fails in do_close for win and unix

git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@29095 3ad0048d-3df7-0310-abae-a5850022a9f2