Now closes program prperly if it's not logged in