Remove connect from write and remove callbacks from connect, pwmpin slot register too fast, OS does not have time to create pwm GPIO folder structure before trying to write to the file.