On the theory of critical fields of superconducting films