Fix tests that violate isolation

The purpose of this PR is to fix a handful of tests that modify global state in some way, either unnecessarily, or necessarily but without restoring the previous state.  This causes tests to fail if they are run multiple times within the same Python session (mainly, multiple subsequent runs of `astropy.test()`).

This PR is not complete--there are still a few more to knock out.  But I'm putting this up now so I don't forget about it.