fix missed state change
work around sqlite java wrapper problem

through java call ,attach a not existing file as database throw up unable to open database xxx,
but C api or shell is just OK