Topological magnetoelectric effects in thin films of topological insulators