A Swedish company has been fined 25,000 kronor ($3,000) after a malfunctioning robot attacked and almost killed one of its workers at a factory north of Stockholm.