Fix array index bug

nextTicketNumber global variable wasn't being decremented when
a closed order was found, so it kept on incrementing.
Added debug print out on ORDERARRAY.