The problems seems to have to do with sqlalchemy, if I only close the database sessions then it hangs, I have to do:
self.engine = db.sa.create_engine(dburl, encoding='utf8', echo=False)
self.Session = db.sao.sessionmaker(autoflush=True, transactional=True)
self.ds = self.Session()
... application does whatever and then on close I do
# if I don't do the del's app does not close
I am checking with the SA list why this is necessary, I probably am doing something wrong somewhere along the lines.
Anyhow thanks for the tips.