Actions after saving a state

I am building an application for a scanner.

Part of the application is a profile management section where a user can change settings for profiles. The user can change one profile at a time and return to the application or s/he can change many profiles in the same session.

In other words OnSave the user will either want to return to the application main screen or the modal containing the profiles.

How do I control this?

Idea

enter image description here

Idea

enter image description here

Which option is better? Is there another way?