Dispose old layout when a new one is selected.