Just call Deactivate() method on your project. Easiest way to access the project you are using in the script is via GetActiveProject() method.
Example:
prj=app.GetActiveProject()
app.PrintPlain(prj)
prj.Deactivate()