Close io stream; use `SecureRandom::uuid` instead of `rand`