Clean up and finalize.