Make the window closed when closed messagebox