Replace perror() with lwsl_warn()

Use the general logging function for printing error messages.