fix race condition in creating services file