Combining Two codes into one (Micro SD shield and Gas sensor)

You only then need to open a file on the SD card.

Better plan to close it, too.