Fix empty keywords
Fix closing stream