Electromagnetic lock with indicator