Let's properly close the input handle once we no longer need it

Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>