android: Close activity when dialog is canceled if it was not visible before