Fixed error dialog not being destroyed