functioning exit confirmation dialog