`$?` is only set *after* `close()` has been called. This fixes the issue where Postfix' `mailq` can't read the queue and returns garbage which can't be parsed by the later code. Fixes #663
@@ -342,6 +342,8 @@ elsif ( $mailq eq "postfix" ) {
@lines = reverse <MAILQ>;
+
+ close(MAILQ);
if ( $? ) {
print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ$mailq_args",$/;