Fixed order of open and event listener so the open event can't accidentally be missed (race condition).