fix copyOut close hanging bug