Update: I figured that it does not crash when I use the original Ansys folder for the compilation (C:\Program Files\ANSYS Inc\v221\ansys\custom\user\winx64) and switch my ANS_USER_PATH variabel to the same folder. It says everywhere that any folder can be used for the compilation as long as the ansusershared.bat and the usermat.f are existant. Looks like that is not the case but everything is working now.