I wrote an apllication that check sql table and if it has proper record then selected command is writen to the serial port.

It's working almost fine, but sometimes application crash.
It seams to writing method that i call by System.Threading.Timer cause exception that i can't find.

What is the better way to write to serial port in time interval.
1. Open the port, call System.Threading.Timer with write method, close the port when closing program
2. call the System.Threading.Timer with operartions: open the port, call write method, close the port