Added error checking to File to Stream