Fixed too many opoen files issue by closing the input stream in case of discarding mails.