How can I pause for the readRecords callback to finish before I try to use the data?

You are struggling with event driven programming. You don’t wait; you call.

Look at this Assigning value from getKeyValue to a variable

Very little in your program should reside outside of a function. It all chains from events that are set into motion by clicking on something.