Using IDisposable again

Now that Close must be called to ensure memory is freed, the IDisposable
pattern is appropriate.