Convert line endings and format the sources
If a device is already open, don't close and open it again.