Attempt at fixing #179 (closed). Locking has been encapsulated, then closed properly according to the portalocker developer. Also, exceptions and keyboard interrupts are handled, so the locking is always properly closed.
The "create" method of autosubmit.py needed error handling and proper closing of the locking. This has been implemented using the suggestions from the documentation of the library, see: https://portalocker.readthedocs.io/en/latest/#tips.
Thorough testing has not been performed, since this error seems to have some probability that is affected by particular conditions of the HPC.