Close streams on Error
Fixed issue where & would cause a 500 error and updated test case accordingly