Rewrite cleanup with RAII.
Rewrite cleanup with RAII.

Rewrite the goto shutdown hack by using the destructor of a local class
to make the code cleaner.

jonasbits/namecoin,Midar/namecoin,eXcomm/namecoin,Midar/namecoin,Midar/namecoin,cryptostorm/namecoin,bankonmecoin/namecoin-legacy,rsackler/namecoin,fflo/sixeleven,okTurtles/namecoin,Midar/namecoin,cryptostorm/namecoin,bankonmecoin/namecoin-legacy,bankonmecoin/namecoin-legacy,eXcomm/namecoin,eXcomm/namecoin,cfromknecht/namecoin-legacy,jonasbits/namecoin,cfromknecht/namecoin-legacy,rsackler/namecoin,rsackler/namecoin,jonasbits/namecoin,cryptostorm/namecoin,namecoin/namecoin-legacy,Midar/namecoin,jonasbits/namecoin,eXcomm/namecoin,eXcomm/namecoin,okTurtles/namecoin,namecoin/namecoin,fflo/sixeleven,namecoin/namecoin-legacy,namecoin/namecoin,bankonmecoin/namecoin-legacy,jonasbits/namecoin,bankonmecoin/namecoin-legacy,namecoin/namecoin-legacy,namecoin/namecoin,rsackler/namecoin,namecoin/namecoin,cryptostorm/namecoin,cryptostorm/namecoin,fflo/sixeleven,okTurtles/namecoin,rsackler/namecoin,cfromknecht/namecoin-legacy,namecoin/namecoin-legacy,okTurtles/namecoin,cfromknecht/namecoin-legacy,okTurtles/namecoin,fflo/sixeleven,namecoin/namecoin,cfromknecht/namecoin-legacy,namecoin/namecoin-legacy