This creates a race condition. You must wrap it in some atomical locking mechanism. Between the time you check and the time you create, even if you ask sysopen for an exclusive create, several processes may think they possess the lock at the same time.
doh! Ta - I knew that there was something vital missing even as I was pressing submit... note to self..don't post before 1st coffee - 'specially on a Sun. morning.