It is safe, in fact this is a way of switching off in an emergency - holding down on/off switch for four seconds.
But I would not recommend regular use to switch off - better to just be patient, or to investigate why switch-off is taking so long.
Huawei P10 review
1995-2015: How technology has changed the world in 20 years
How VR is being used to simulate space
New iPad, iPhone SE & Red iPhone 7 on sale now
Synology invites you to visit them at Insomnia on 26th – 29th August. Book your tickets now and visit Synology.