Add additional guards for nix process detach
Add additional guards for nix process detach

Observing some weird race-condition-y behaviors where the nix.sh script
previously was not reliable in rebooting systems. Most of the time with
an attached TTY, the subprocess was still being killed when the
TTY-attached parent shell terminated.

Adding a `sync` call seems to work around the problem.

Adding an explicit `disown` for linux just for completeness. It was not
shown to help with the observed race condition (which is resolved by
`sync`). `disown` is a bash built-in, and this is a bash script so we
should be fine to use it.

puppetlabs/puppetlabs-reboot,puppetlabs/puppetlabs-reboot