Before finishing the mission on the Island of the Pirate Treasures, make sure to transport all the resources you need to your farm. Once you open the chest and leave the island, it will close automatically.

P.S. Please also keep in mind that you need to finish all the related mission steps within 3 days.