When you use multiple displays, wherever you leave an application window open, that is where it will show up next time you run that application. So, to prevent this from happening in the future, simply drag the window back to your main monitor before you quit the application and turn off the second monitor.