On a Tauberian theorem with the remainder term and its application to the Weyl law