The Nonequilibrium Statistical Mechanics of Open and Closed Systems