Fix bug to avoid closing current view.