fix *nix build and flesh out close() more