PGXL-3: GTM_WriteRestorePoint leaks file handle and fails on startup

1. Don't open the file unless needed
2. Prevent file handle leak