Moved DOS handle allocation slightly, to fix potential memory