Fixed several issues, environment vars now work
Fixed process shutdown behaviour to close fd's before wait() so that pipelines don't hang on child exit.