Added a change directory command before restarting the application. This prevents pid.txt from being inadvertently written to the wrong location