I'm on a Linux Mint machine and whenever I close a tab using the middle mouse button, my previously selected text gets inserted in the next open tab.