Fix bugs/race conditions
Fix bugs/race conditions

Following suggestions from @psyeugenic, this code terminates and waits
for the termination of the port handling IO before booting our own,
which should get rid of annoying warnings.

We also allow for the failure to shutdown the user worker under
kernel_sup, since it is likely not there anymore in many scenarios,
preventing crashes.

tsloughter/rebar3,benoitc/rebar3,rebar/rebar3,lrascao/rebar3,vladdu/rebar3,djnym/rebar3,rebar/rebar3,norton/rebar3,benoitc/rebar3,erlang/rebar3,ferd/rebar3,saleyn/rebar3