debug.sh works without initial big sleep.

I've found the way to detect if the emulator has finished booting, so
that I can install and start leap_android without problems.

I've moved the last sleep before the pid calculation, because sometimes
it wasn't calculated well (I think because I asked for it too soon).