Make it optional to exit on success, but don’t exit in case the default keychain is already unlocked when the app launches.
Launch Terminal with “security set-keychain-password” instead of opening Keychain Access

This way the user can paste the password, something that is not possible with the Keychain Access “change keychain password” dialog.