[BUGFIX] Flush caches after changing package states
This adds a flush caches call to the end of all commands which affect
the package state (that is create, delete, activate and deactivate).
For this special case – modifying the code base during a script run –
it is necessary to exit early in order to prevent unforeseeable problems
with removed or altered code.
In the longterm the caches should also be flushed when the Package
Manager's API methods are used – but that's not in the scope of this