Properly detach forked processes