Pirate ships should not despawn until every npc that was on board has been killed, and 1 or 2 minutes has been given to the player to collect the loot.
Reason to add/change
Sometimes, the captain and co-captain are too hard to deal with, so you have to run for a while and slowly kill them, and by that time the ship has probably despawned and you got no loot. This has happened to me at least 3 times. It’s kinda annoying to go through all that and not even get a single sealed chest out of it.