Correct AMD function, and ensure browser quits before process does