Move common block in except/catch to finally
Found while reviewing an exception I had in !395 (merged) and reading our code.
In bin/autosubmit.py
, every except
block is doing the same thing: looking for a lock file and removing it if present.
This is commonly done in a finally statement, which prevents one of forgetting of doing that, and simplifies code & maintenance. Creating this issue so we don't forget about it.
It would be good to go over our code and see if there are other parts with the same issue (this finally was available in Python 2, so chances are high that we have more of that).