LPS-51805 Always close writers
LPS-51805 Update clean logic