Are both try to save the file and try saving the file grammatically correct? If so, is there any difference in meaning?
They're of course both grammatical, but there is a conventional meaning difference that may not be obvious, as there often is with a verb like try that takes both Equi infinitive and Equi gerund complements. Such available syntactic bandwidth is likely to get used for pragmatic purposes.
In this case, the gerund is the one without any special entailments — i.e, saying
requires no special interpretation by a listener — or at least is intended to sound that way — while in
the infinitive complement (but not the gerund) is subject to the Gricean interpretation (i.e, an interpretation that is predictable from Grice's Maxims) that, if one can only say truthfully "He tried to open it" instead of just "He opened it", then one conversationally implicates his failure in opening it.
So, in context, (1) above can continue with any of the following:
but only the first one is appropriate as a continuation for (2).
Strictly speaking, "try doing something" usually implies you should try doing it as it's expected to solve a certain problem. On the other hand, "try to do something" usually implies a sole challenge, not necessarily with any practical result.
A) To imply an expected solution to a problem:
B) To imply a challenge:
So, to directly answer your question, this is how your examples explain themselves: