def test_closed_file_not_usable(self):
     filename = os.path.join(self.temp_dir, 'test.cuds')
     with closing(H5CUDS.open(filename)) as handle:
         handle.add_dataset(Mesh(name="test_1"))
         handle.add_dataset(Particles(name="test_2"))
         lattice = make_cubic_lattice("test_3", 1.0, (2, 3, 4))
         handle.add_dataset(lattice)
         test_h1 = handle.get_dataset("test_1")
         test_h2 = handle.get_dataset("test_2")
         test_h3 = handle.get_dataset("test_3")
     with self.assertRaises(Exception):
         handle.get_dataset('test_h1')
     with self.assertRaises(Exception):
         test_h1.name = 'foo'
     with self.assertRaises(Exception):
         test_h2.name = 'foo'
     with self.assertRaises(Exception):
         test_h3.name = 'foo'