Made shutting down check for open programs