using ``exists`` followed by an ``open`` creates a race condition. Using a try...except pattern would be more robust.