Implement a workaround solution for saving manual script state changes by the user before logout instead of wrongly removing the script early.

This workaround relies on the fact that a closing client goes inactive before the attachments derez calls happen.
This reverts the change to remove scripts too early instead of stopping them, since the the two step stop then remove is necessary to execute the detach event.