wasnt writing data, passing the result of opening the port as parameter to exitdefault function