Replacing 'with' statements for file open in artifact.py