erts: Fix bug in enif_term_to_binary
erts: Fix bug in enif_term_to_binary

Wait until after dec_term and factory_close to do cache_env(),
otherwise we will cache the wrong state.

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