Steps to reproduce:
open some files in tabs
search something in one of the tab files
don’t press escape and click another tab
if you now try to write you still locked and writing on the previous one.
A possible solution is to auto dispose the search before switching the tab.