Yes it is the right behavior as if the same record is in use while you are accessing it from Back/Front end which means that particular record is in use which means it is in use elsewhere and Cannot be processed is
the cause of the error faced earlier.
The correct behavior is that when after closing "shipping transaction form" for the same delivery ID and execute the script - released status is closed and interface trip stop is executed automatically.
And user will not face any error for records can not be locked.