Check for windows and darwin, else assume *nix
Pretty sure that defer wasn't helping at all. Duh.