Using IDisposable to avoid the gotos.