Made a console app which worked fine, and now the Lazarus the app doesn't have to close the query either. Problem disappeared over night. :-) No idea what that was, I tested repeatedly yesterday. Oh well, sorry for bothering!