A local compactness theorem for Maxwell's equations