Chdir to specified directory and xopen