Code refine.
Added close handler.
Create gui manager in init.