fix: switch inputstream once stream has been closed