File TOUCH error

I have the below code in one of my CMakeList.txt files.

# Create a config file to differentiate Release and Debug build version
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
  file( TOUCH "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/developer_build.config")
endif()

I’m running this project on Visual Studio 2019. It works fine almost all the time. But occasionally it fails with the below message.

Error CMake Error at D:\XXX\Simulator\soruce\apps\NetworkUI\new_gui\CMakeLists.txt:84 (file):
file problem touching file:
D:/XXX/Simulator/soruce/apps/NetworkUI/new_gui/out/build/x64-Debug
(default)/output/developer_build.config exe_ui D:\XXX\Simulator\soruce\apps\NetworkUI\new_gui\CMakeLists.txt 84

Error is not consistent and hard to reproduce. Once it happened when I opened the Visual Studio for the first time after a system reboot.

Does anyone have any clue, why this is happening. ?
Thanks in Advance

I edited your question to better see the examples you have. However, some of the quoting is weird in the error message (specifically where that exe_ui D:\XXX\… part comes from). Could you please paste the error as-is between triple-backquotes (`)?