kernel: Fix hanging os:cmd race condition
kernel: Fix hanging os:cmd race condition

If the port terminates before Port ! close is issued,
there will be no 'closed' reply, so the old code would
hang. As it turns out there is no way to figure out
if a closed reply is supposed to come as that reply
is sent after all links and monitors are triggered.
So we have to use the synchronous port_close to close
the port.

electricimp/otp,rlipscombe/otp,ferd/otp,aboroska/otp,rlipscombe/otp,emacsmirror/erlang,dumbbell/otp,bsmr-erlang/otp,release-project/otp,fenollp/otp,bernardd/otp,aboroska/otp,release-project/otp,isvilen/otp,cobusc/otp,release-project/otp,matwey/otp,erlang/otp,erlang/otp,g-andrade/otp,g-andrade/otp,release-project/otp,weisslj/otp,vladdu/otp,jj1bdx/otp,lrascao/otp,dgud/otp,matwey/otp,falkevik/otp,dumbbell/otp,weisslj/otp,electricimp/otp,tuncer/otp,bsmr-erlang/otp,mikpe/otp,kvakvs/otp,dumbbell/otp,erlang/otp,bernardd/otp,RaimoNiskanen/otp,bjorng/otp,vladdu/otp,lrascao/otp,matwey/otp,legoscia/otp,bsmr-erlang/otp,rlipscombe/otp,bjorng/otp,electricimp/otp,bernardd/otp,bsmr-erlang/otp,vinoski/otp,fenollp/otp,aboroska/otp,isvilen/otp,tuncer/otp,g-andrade/otp,cobusc/otp,aboroska/otp,rlipscombe/otp,isvilen/otp,falkevik/otp,electricimp/otp,saleyn/otp,jj1bdx/otp,RaimoNiskanen/otp,bjorng/otp,rlipscombe/otp,RaimoNiskanen/otp,potatosalad/otp,saleyn/otp,lrascao/otp,g-andrade/otp,dgud/otp,electricimp/otp,saleyn/otp,tuncer/otp,RoadRunnr/otp,bjorng/otp,fenollp/otp,bsmr-erlang/otp,weisslj/otp,cobusc/otp,vladdu/otp,electricimp/otp,aboroska/otp,dgud/otp,RaimoNiskanen/otp,vinoski/otp,weisslj/otp,legoscia/otp,kvakvs/otp,weisslj/otp,matwey/otp,vinoski/otp,cobusc/otp,erlang/otp,dgud/otp,lrascao/otp,bjorng/otp,jj1bdx/otp,getong/otp,falkevik/otp,potatosalad/otp,mikpe/otp,goertzenator/otp,isvilen/otp,fenollp/otp,uabboli/otp,fenollp/otp,dgud/otp,bsmr-erlang/otp,legoscia/otp,massemanet/otp,massemanet/otp,ferd/otp,rlipscombe/otp,legoscia/otp,rlipscombe/otp,getong/otp,potatosalad/otp,ferd/otp,ferd/otp,massemanet/otp,bernardd/otp,release-project/otp,falkevik/otp,saleyn/otp,fenollp/otp,lrascao/otp,emacsmirror/erlang,RaimoNiskanen/otp,saleyn/otp,electricimp/otp,uabboli/otp,emacsmirror/erlang,bernardd/otp,g-andrade/otp,kvakvs/otp,mikpe/otp,uabboli/otp,getong/otp,legoscia/otp,matwey/otp,jj1bdx/otp,dumbbell/otp,cobusc/otp,bsmr-erlang/otp,ferd/otp,lrascao/otp,tuncer/otp,electricimp/otp,dumbbell/otp,matwey/otp,bjorng/otp,weisslj/otp,massemanet/otp,kvakvs/otp,vinoski/otp,falkevik/otp,potatosalad/otp,kvakvs/otp,dumbbell/otp,dgud/otp,RoadRunnr/otp,tuncer/otp,emacsmirror/erlang,RoadRunnr/otp,vinoski/otp,massemanet/otp,legoscia/otp,massemanet/otp,falkevik/otp,legoscia/otp,goertzenator/otp,isvilen/otp,dumbbell/otp,vladdu/otp,matwey/otp,kvakvs/otp,jj1bdx/otp,isvilen/otp,saleyn/otp,dgud/otp,potatosalad/otp,RoadRunnr/otp,goertzenator/otp,release-project/otp,RaimoNiskanen/otp,getong/otp,bjorng/otp,tuncer/otp,aboroska/otp,erlang/otp,ferd/otp,vinoski/otp,RaimoNiskanen/otp,dgud/otp,saleyn/otp,vladdu/otp,RaimoNiskanen/otp,RoadRunnr/otp,jj1bdx/otp,ferd/otp,uabboli/otp,bjorng/otp,mikpe/otp,ferd/otp,emacsmirror/erlang,isvilen/otp,potatosalad/otp,potatosalad/otp,bernardd/otp,erlang/otp,jj1bdx/otp,erlang/otp,isvilen/otp,rlipscombe/otp,bernardd/otp,uabboli/otp,g-andrade/otp,dumbbell/otp,goertzenator/otp,goertzenator/otp,RoadRunnr/otp,vladdu/otp,mikpe/otp,vladdu/otp,goertzenator/otp,getong/otp,legoscia/otp,isvilen/otp,dumbbell/otp,emacsmirror/erlang,getong/otp,massemanet/otp,saleyn/otp,bernardd/otp,potatosalad/otp,erlang/otp,tuncer/otp,uabboli/otp,emacsmirror/erlang,kvakvs/otp,g-andrade/otp,getong/otp,uabboli/otp,g-andrade/otp,rlipscombe/otp,dumbbell/otp,mikpe/otp,cobusc/otp,fenollp/otp,potatosalad/otp,kvakvs/otp,erlang/otp,g-andrade/otp,tuncer/otp,legoscia/otp,potatosalad/otp,getong/otp,bjorng/otp,release-project/otp,falkevik/otp,mikpe/otp,weisslj/otp,goertzenator/otp,rlipscombe/otp,dgud/otp,vladdu/otp,aboroska/otp,g-andrade/otp,getong/otp,uabboli/otp,falkevik/otp,aboroska/otp,aboroska/otp,lrascao/otp,fenollp/otp,vinoski/otp,isvilen/otp,cobusc/otp,cobusc/otp,vladdu/otp,RoadRunnr/otp,RaimoNiskanen/otp,saleyn/otp,emacsmirror/erlang,RoadRunnr/otp,RoadRunnr/otp,goertzenator/otp,dgud/otp,vinoski/otp,bernardd/otp,vinoski/otp,lrascao/otp,bsmr-erlang/otp,goertzenator/otp,massemanet/otp,jj1bdx/otp,bsmr-erlang/otp,jj1bdx/otp,mikpe/otp,mikpe/otp,massemanet/otp,matwey/otp,ferd/otp,vinoski/otp,tuncer/otp,jj1bdx/otp,lrascao/otp,release-project/otp,emacsmirror/erlang,fenollp/otp,weisslj/otp,kvakvs/otp,emacsmirror/erlang,weisslj/otp,mikpe/otp,erlang/otp,bjorng/otp,matwey/otp,falkevik/otp,uabboli/otp,release-project/otp,electricimp/otp,getong/otp