I think Enter should only work on controls that are on focus. The Primary button should generally be on focused by default. For this case the enter shouldn't close the window because the search field is on focus.