Fix WithTempDirectory

In 61b3aaa5757ef1768ac8ed73122473020c66d9a8, `WithTempDirectory` was changed to defer its actions; this left all the temp files on the disk when running tests.