If you caught a Pokemon, but closed the game without ever saving since then, it could be lost forever with nothing you can do about it now.
They could be in Poke Pelago (Isle Evelup/Isle Avue) or a Poke Job, where you have to go retrieve them before they can go back to your party or a PC box.
If you have a fused Kyurem or Necrozma, the data for the consumed Reshiram, Zekrom, Solgaleo, or Lunala is stored in a similar spot to where the game keeps track of your day care deposits. You'll have to use the un-fusion version of the item to get that back.
If you deposit something in the GTS, but no one has redeemed your trade yet, it's possible for you to go back there and retrieve your Pokemon--until you do so, it will be locked away in your GTS slot, not accessible from the PC.