Add some protection against an uncaught exception in the CharmmFile destructor

Add a test case and example for running with CHARMM files.