You can install wmctrl to achieve this with the following command:
bash -c 'wmctrl -a file1.txt || leafpad ~/file1.txt'
The -a option switches to the window with the title containing file1.txt. However if the command fails, i.e. ||, then it will open your file.
See if this works Simon. Add this script to your ~/bin folder and name it xfce4-session-logout. Please follow up if you would like assistance in setting up a ~/bin folder, i.e. making sure it is in your $PATH or making the script executable.
if [ "$1" == "--suspend" ]; then
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/...