Write port number to file