Ozzy is right that the warning message on shutdown can be avoided by setting up the Pervasive Workgroup Engine to run as a service. Instructions on how to do that are in the Pervasive Knowledge Base in article ID psql1828.
The "invalid session" errors are likely the result of the gateway machine being shut down while others are still connected to the Maximizer database. Check your configuration against the Maximizer documentation, paying special attention to the section on the gateway settings.