Placing instance of different categories in a project

At the moment I have a simple script to place instances of a category into a Revit project.

The script works fine. When I run the script it places the items in the project on the proper location. However when I select a different category and run it again it places those items but removes the instances chosen in the previous run. I expect it has to do with that the transaction has not be ended for the first run.

I have tried putting transaction.end nodes attached to different nodes in the script. I also tried to combine it with transaction.start nodes. However without luck. What can I do to get his to work. As a work round I now would have to close and reopen Dynamo (



Another inefficient work around would be to repeat/copy the same nodes and change the Category